=== GreenScore WP ===
Contributors: mishamanko
Tags: speed, pagespeed, core web vitals, performance, optimization
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.4.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Check how fast your homepage loads with Google PageSpeed, see what slows it down in plain English, and fix it one problem at a time.

== Description ==

Click **Check page speed** and Google PageSpeed tests your homepage on a phone and on a desktop computer. You get both scores, the Core Web Vitals, and a short list of the problems that slow the page down, written in plain English.

**What you see**

* Mobile and desktop scores, coloured like PageSpeed: red for very slow, yellow for slow, green for fast.
* The problems, biggest first, each with what it costs and the fix that solves it.
* Core Web Vitals for phones and computers.
* Your site setup: page builder, cache and image plugins, WooCommerce, WordPress and PHP versions.
* Protected pages: booking, payment, checkout and form pages are found automatically and are never changed.
* A history of your last checks, an optional weekly check and an email when the mobile score drops.

**One-click fixes, tested on your own pages.** Fix one problem, a few, or everything at once. Before every fix the plugin saves a backup. After each fix it loads your homepage, your protected pages and the pages you chose, the way a visitor would. If a page stops loading, shows an error, or loses a form or booking widget, the fix is undone at once.

Fixes in this version (12): WebP images, right-sized images, missing image sizes, lazy-loading, the top image first, only the font weights in use, Google Fonts hosted on your site, tracking scripts after the first scroll or tap, plugin scripts only where they are used, Google Maps on click, Elementor's speed settings and a page cache. The FAQ says what each one does.

Fixes change how pages are sent to visitors. They never edit your posts, theme files, original images or other plugins' files. Logged-in editors always see the page as it is, so page builders keep working on the original.

**Backups.** Every fix, undo and restore saves a backup first. The Backups tab lists them, and "Something broke? Restore the last backup" at the top of every tab puts the last one back.

**Plain-English explanations.** After each check, a short note says what slows the site most and what to do first, and each problem gets a line on why it matters.

**Expert help.** Some problems need a person: the plugin shows "Get expert help" for them. Our speed engineers fix one problem by hand for a one-off $100, paid on Gumroad. You then let them in with a separate small plugin, Expert Access, for 14 days, and you can switch it off any time.

== Installation ==

1. Install and activate the plugin. It opens its page for you (GreenScore WP in the admin menu).
2. Click "Check page speed" and wait about 30 seconds.
3. Read the problems and the Core Web Vitals.

== Frequently Asked Questions ==

= Does it change anything on my site? =

Only when you click a fix. Fixes change the HTML sent to visitors while they are on, save files of their own (WebP copies, font files, page copies), or switch on settings of Elementor. Every change can be undone, and a backup is saved first.

= What does each fix do? =

* **Convert images to WebP:** saves a smaller WebP copy next to each JPEG and PNG in your media library and sends it to browsers that can show it. Your original images are never changed.
* **Resize images to the size shown:** makes sure WordPress offers smaller versions of images that show smaller than their file, so phones download less.
* **Add missing image width and height:** adds the size to images that have none, so the page stops jumping while it loads.
* **Lazy-load images further down the page:** images below the first screen load only when a visitor scrolls near them.
* **Load the top image first:** tells the browser to fetch the biggest image at the top of the page before anything else.
* **Load only the font weights in use:** asks Google Fonts only for the weights and styles your pages use, and shows text while fonts load.
* **Host Google Fonts on the site:** copies the Google Fonts your homepage uses to your own site, so visitors' browsers don't have to connect to Google first.
* **Start tracking scripts after the first scroll or tap:** analytics and ad scripts (like Google Tag Manager or the Facebook Pixel) start when the visitor first interacts with the page, or after a few seconds.
* **Load plugin scripts only on pages that use them:** form and add-on scripts load only on the pages where the form or widget is.
* **Load Google Maps on click:** an embedded map shows a "Show map" button and loads when a visitor clicks it.
* **Switch on Elementor's speed settings:** switches on Elementor's own performance settings (only when Elementor is active).
* **Page cache:** keeps a ready copy of each page for visitors who are not logged in, so WordPress doesn't build the page on every visit (only when no other page cache plugin is active).

= How do undo and backups work? =

Before every fix, undo and restore, the plugin saves a backup: which fixes were on and their settings. The first backup, "Original site", has every fix off and is never deleted. "Undo" next to a fixed problem switches that fix off and deletes what it made. The Backups tab lists every backup; restoring one switches fixes on and off until your site matches it, then loads your pages to check them. Backups hold the plugin's fixes only, not your posts, pages or bookings.

= A page looks wrong after a fix. What do I do? =

Click "Something broke? Restore the last backup" at the top of the plugin page. It works even if the page's buttons do not.

= What is safe mode? How do I switch every fix off at once without the dashboard? =

Add `define( 'MMSS_SAFE_MODE', true );` to wp-config.php. No fix runs for visitors while it is there, and the page cache sends no saved copies. Your fixes stay recorded, so removing the line switches them back on. To look at a page without fixes while you are logged in as an admin, add `?mmss_off=1` to its address. (Logged-in editors see pages without fixes anyway.)

= What happens when I deactivate or delete the plugin? =

Deactivating puts Elementor's settings back as they were; the other fixes stop by themselves. When you activate the plugin again, it offers to turn your fixes back on. Deleting the plugin undoes every fix and removes everything it stored.

= Why does it need an outside service? =

Google PageSpeed needs an API key. The key stays on the GreenScore WP service and never reaches your site. Your site gets its own site key instead.

= Can it check a local or staging site? =

No. Google can only test pages that are open to the internet.

= How many checks can I run? =

Up to 10 a day per site. Each check tests the phone and desktop versions separately.

== External services ==

This plugin uses the GreenScore WP service at https://site-speed-api.misha-398.workers.dev, which runs Google PageSpeed Insights for your site, writes the plain-English explanations and handles expert help requests.

* **When you click "Check page speed" for the first time (connecting):** nothing is sent before that click. The plugin sends your homepage address, your WordPress version and the plugin version. To prove the request comes from your site, the service then loads one address on your site (`/wp-json/mmss/v1/verify/<id>`) that answers with a one-time code for 10 minutes. The service returns a site key that is stored in your database.
* **When you click "Check page speed", and once a week if you switch on the weekly check (only after a first manual check):** the plugin sends your homepage address and your site key. The service asks Google PageSpeed Insights to test that page and returns the scores and findings. The service keeps your site address, a hash of the site key, and the dates and scores of your checks.
* **After each check (explanations):** the plugin sends the scores, the list of problems found (their names, estimated savings and a one-line description), and your setup: page builder, theme name, cache plugin name, whether WooCommerce is active and how many protected pages there are. The service asks Anthropic's Claude AI to write the explanations and keeps the answer for 7 days so the same check is not explained twice. No content of your pages and no personal data is sent.
* **When you send an expert help request (only when you click "Continue to payment"):** the plugin sends your email address, your description of the problem, the page you picked and, if you leave the box ticked, the diagnostic report the form shows you (scores, problems found, fixes switched on, backups count, WordPress and PHP versions, theme, and the names and versions of active plugins). The service keeps the request so the expert team can work on it, and emails it to the team. Payment happens on Gumroad's own checkout page, which opens in a new tab; the plugin never sees your card. When you paste the licence key from your receipt, the plugin sends it to the service, which checks it with Gumroad. The plugin then asks the service for the request's status and the team's messages while the help tab is open.

Privacy policy: https://greenscorewp.com/privacy - Terms: https://greenscorewp.com/terms

Google PageSpeed Insights is run by Google. Google's terms: https://developers.google.com/terms and privacy policy: https://policies.google.com/privacy

Claude is run by Anthropic. Anthropic's terms: https://www.anthropic.com/legal/commercial-terms and privacy policy: https://www.anthropic.com/legal/privacy

Gumroad is run by Gumroad, Inc. Gumroad's terms: https://gumroad.com/terms and privacy policy: https://gumroad.com/privacy

The plugin also loads your own homepage from your site, to look at its code for images, fonts and scripts, and after each fix it loads your homepage, protected pages and pages to test to make sure they still work. Those requests stay between your site and itself.

== Changelog ==

= 0.4.1 =
* More of Google PageSpeed's performance findings are listed: scripts that make the browser redo the layout, a heavy page, slow reactions to taps, a page not set up for phone screens, extra address steps before the page opens, and animations that stutter on phones. These have no one-click fix and show "Get expert help".
* Long script tasks and layout shifts now count toward "Scripts keep phones busy" and "Page jumps while it loads".
* A short note under the scores: Google runs the test from different places in the world, scores move a few points between checks, and Google's own PageSpeed page can show a different number.

= 0.4.0 =
* Get expert help: a new tab to ask our speed engineers to fix one problem by hand ($100, paid on Gumroad), see the request's status and the team's messages, and ask again when a fix stops working.
* Problems the plugin has no one-click fix for show "Get expert help" (with the problem filled in) instead of "Coming soon". So does the message when a fix was undone.
* Plain-English explanations after each check: what slows the site most and what to do first, a "Why it matters" line under each problem, and the problems in the suggested order. If the explanation service is not available, the plugin shows its own texts.
* The product name comes from one place (MMSS_BRAND).

= 0.3.0 =
* All 12 fixes of the first version: WebP images, right-sized images, the top image first, only the font weights in use, Google Fonts hosted on your site, tracking scripts after the first scroll or tap, plugin scripts only where they are used, and a page cache join lazy-loading, image sizes, Google Maps on click and Elementor's speed settings.
* Clearer results: "Undone" when a fix broke a page and was put back, "Couldn't switch on" when it could not be applied, "Not for this site" when it does not apply.
* Problems only promise what "Fix this" switches on today.
* Visitor pages no longer look up the site setup: the plugin reads one small saved index.
* Hosted fonts are rebuilt when the font weights fix is switched on or off.
* WebP images: Vary: Accept is sent only when a background image was switched; restoring a backup finishes the WebP conversion while the page is open.
* The Backups tab shows the date of the latest backup.

= 0.2.0 =
* One-click fixes with a backup before each, an automatic test of your pages after each, and automatic undo when a page breaks: lazy-load images, add image sizes, load Google Maps on click, Elementor speed settings.
* Backups tab, "Restore the last backup" link on every tab, safe mode.
* Requires WordPress 6.2.

= 0.1.0 =
* First version: page speed check, problems in plain English, Core Web Vitals, site setup, protected pages, history, weekly check and score-drop email.
