=== Wattgrade – Cost Scorecard ===
Contributors: j4cob
Tags: performance, plugins, database, autoload, diagnostics
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Measures what each active plugin costs your site on your own real data and gives every plugin an honest A-F grade.

== Description ==

Wattgrade measures the real cost of the plugins that are active on your site. It looks at four things on a normal homepage request and gives each plugin a simple grade from A to F:

* CSS and JavaScript that the plugin adds to the page.
* Database queries that the plugin runs during the request.
* Size of the plugin's autoloaded options.
* Remote HTTP calls the plugin makes while the page loads.

It also records one site-wide figure: how long WordPress took to boot on that request.

The overall grade is the worst of the four metric grades. Wattgrade also writes a short plain-English reason for every grade, for example "Loads 412 KB of JavaScript on your homepage" or "Adds 63 database queries to a homepage request".

= Honest and local by design =

Wattgrade runs entirely on your own site. It does not contact any external service, it does not send telemetry, and it loads no assets from a CDN. The measurement results are stored in your own database.

Wattgrade never deactivates, edits, or reconfigures another plugin. A measurement makes one logged-out request to your homepage. Outside a measurement run it adds almost no overhead.

= What is approximate =

Wattgrade tries to be clear about what it can and cannot know:

* CSS and JavaScript sizes are uncompressed local file sizes plus inline data. External assets are listed but not downloaded or measured.
* Database queries are attributed using a backtrace. Some queries cannot be attributed to a plugin and are reported separately.
* Boot time is recorded once per run, from the start of the homepage request until every active plugin has loaded. It covers WordPress core and all plugins together, so it is site context and is never attributed to a single plugin.
* Autoloaded option sizes are exact, but matching an option to a plugin uses names and option prefixes, so attribution is approximate. The unmatched total is always shown.
* Remote HTTP calls are detected through the WordPress HTTP API and blocked during the measurement. Calls made with a plugin's own HTTP library are not detected.

A grade describes the cost of a plugin on your site in one run. It is not a review of plugin quality, and a high grade is not a verdict.

= Features =

* A grade column on the Plugins screen.
* A Tools page with a site summary and per-plugin details.
* A comparison with the previous run, including plugins that were updated in between.
* Clear notes about anything the run could not measure.
* No custom database tables.

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the Plugins screen in WordPress.
3. Go to Tools > Wattgrade and click "Run measurement".

The first measurement is the baseline. Run Wattgrade again later, for example after updating plugins, to see what changed.

== Frequently Asked Questions ==

= Does Wattgrade change or deactivate my plugins? =

No. Wattgrade only measures. It does not modify other plugins and it never deactivates them.

= Does Wattgrade send any data off my site? =

No. Wattgrade makes no external requests, has no telemetry, and loads no remote assets. Measurement results stay in your own database.

= Why is a plugin not graded? =

Inactive plugins are not loaded on page loads, so they are not graded. Their leftover autoloaded options are still shown, because those options can still add weight to every request.

= Why is a plugin's number different from another tool? =

Different tools use different methods. Wattgrade measures on your site with your active theme and content. Sizes are uncompressed, queries are attributed by backtrace, and boot time covers the whole site rather than one plugin. Use the grade as a guide, not as an absolute number.

= Why did a grade change after a plugin update? =

Run a new measurement after updating plugins. Wattgrade compares the new run with the previous one and lists updated plugins, version changes, grade changes, and metric changes.

= Can I run Wattgrade on a multisite network? =

Wattgrade can run on multisite and respects network-activated plugins. Results and cleanup are handled per site, and network options are removed on uninstall.

== Screenshots ==

1. The Wattgrade Tools page after a measurement: site snapshot, grade distribution, metric totals, and the comparison with the previous run.

== Changelog ==

= 1.0.0 =
* First release.
* Measures CSS and JavaScript, database queries, autoloaded options, and remote HTTP calls, plus one site-wide WordPress boot time.
* Grades each active plugin from A to F using the worst metric.
* Adds a grade column on the Plugins screen.
* Adds a Tools page with per-plugin details and a previous-run comparison.
* Stores two non-autoloaded result options and adds no custom tables.

== Upgrade Notice ==

= 1.0.0 =
First release.
