=== AdMindra Turbo – Page Cache & Speed, Safe for WooCommerce ===
Contributors: 3onab, viktorygrahn
Tags: cache, page cache, performance, pagespeed, woocommerce
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.8.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Free page cache that keeps WooCommerce carts and checkouts private. Sets itself up, every change can be undone. No account, nothing sent anywhere.

== Description ==

AdMindra Turbo makes WordPress answer faster by keeping a ready copy of public pages for anonymous visitors, and it tells you plainly what else slows your site down, how risky each fix is, and whether it can be undone.

Everything is off until you turn it on. Nothing is sent to AdMindra. No account is needed.

= Page cache =

* Stored copies are served before WordPress loads, from `wp-content/advanced-cache.php`. On the sites we test, a stored page answers in a few milliseconds instead of a full render (see "How was this tested?").
* Only for anonymous visitors. Logged-in users, and anyone with a login, cart, session, comment or password cookie, always get a fresh page. Analytics and ad cookies (Google Analytics, Meta, Microsoft, HubSpot, Cloudflare's bot cookies and similar) do not stop a visitor from getting the stored page.
* Links with `utm_`, `gclid`, `fbclid` and similar tracking parameters get the stored page; any other query string gets a fresh one.
* A page is not stored when it carries a filled-in password field, a form that posts to this site (other than a search, a comment, WooCommerce's login box or, with catalog caching, add to cart), another system's CSRF token, a `Set-Cookie` (other than an analytics cookie such as `_fbp`, which is then never handed to other visitors), a redirect, a private or `no-store` cache header, or a content security policy nonce.
* WordPress nonces are kept with a page only when it was built for a visitor who is not logged in and has no cart: WordPress gives every such visitor the same nonce for 12 to 24 hours, and Turbo keeps a page at most one hour. A site that shortens the nonce life below two hours keeps refusing them.
* When a post changes, Turbo removes that post, the front page, the blog page and its category and tag pages, and nothing else. A theme, menu, widget, site title or permalink change clears everything. Plugins that write options on every page view (Elementor, Action Scheduler, WooCommerce Admin and others) do not clear the cache.
* A copy lives at most one hour. Up to 2,000 pages and 128 MB.
* Never deletes or overwrites another plugin's `advanced-cache.php`, and turns itself off if another page cache plugin is switched on. Changes `wp-config.php` only when you click to turn the cache on: one line, `WP_CACHE`, checked against your live site at once and taken out again when you deactivate Turbo.

= WooCommerce Safe Mode =

* Cart, checkout, My account, the order-received page, payment pages, the Store API, `wc-ajax` and `wc-api` callbacks are never stored, including when you rename those pages.
* A visitor with a cart or a WooCommerce session never gets a stored page, so one customer's cart never reaches another.
* Shop, product, category pages and any page that lists products with prices are not stored unless you turn on "Cache shop and product pages". When you do, a stock change (an order, a refund, an edit), a price change, a scheduled sale and a variation's stock all remove the affected pages at once.
* Turbo refuses catalog caching where prices may depend on the visitor: geolocation of customers, currency switchers, role or member prices, wholesale and B2B pricing, and coming-soon mode.

= Cloudflare =

* By default Turbo tells Cloudflare (and other CDNs that honour `CDN-Cache-Control`) not to keep its HTML. Static files are not affected.
* The edge check asks your site from the outside, as a visitor would: whether the edge keeps HTML, and whether it would serve a kept page to a visitor with a login or cart cookie. If it would, Turbo shows that first, with what to change in Cloudflare.
* Optional: connect a Cloudflare API token with only Zone Read and Cache Purge for your zone. Turbo then purges the changed URLs at Cloudflare too (30 per call, in the background, so a customer never waits on Cloudflare). It never changes Cloudflare settings, Cache Rules or Workers.
* Optional edge mode lets Cloudflare keep Turbo's pages. It stays on only after the edge check proves that logged-in and cart visitors bypass the edge, and it turns itself off if a purge fails.
* While the official Cloudflare plugin is active, Turbo's page cache stays off (with APO, Cloudflare owns the page cache) and Turbo's other features keep working.

= Page check and findings =

* "Run page check" fetches your front page, newest post, shop and newest product twice each and counts what slows them down: render-blocking scripts and stylesheets, images without dimensions, images a script lazy-loads, several high-priority images, Google Fonts without `display=swap`, the emoji script, third-party script hosts, and the cache state. It stores those counts and up to two addresses per page of the likely main (LCP) image. It is not a Core Web Vitals score and never presented as one.
* Every finding says what the problem is, where, the expected effect (always marked as an estimate unless measured), its risk class (1 safe to apply automatically, 2 needs verified compatibility, 3 needs your approval, 4 must not be optimized), what to do, whether Turbo may do it, whether it can be undone, and how to verify it.
* "Optimize safely" turns on class 1 switches only, and Undo restores the switches exactly as they were.

= Optimizations =

* One high-priority image per page, `display=swap` and a preconnect for Google Fonts the site already uses, removing the emoji script, refilling the cache after a change.
* Main image per page: name the image PageSpeed calls the "Largest Contentful Paint element" and Turbo loads it at once, with high priority and a preload, even when the theme lazy-loads it with a script. Only that image, only on that page; removing the line gives back the page exactly as the theme sends it.
* WebP or AVIF for new JPEG uploads, using WordPress's own image editor: the sizes WordPress makes, and the full-size copy it shows, are WebP or AVIF, while the uploaded JPEG is kept unchanged as WordPress's original. Existing images are never touched, nothing is converted twice, and there is no bulk conversion.
* Merge stylesheets: this site's own stylesheets that stand next to each other in `<head>` load as one file, in the same order, so a phone makes one request instead of dozens before it draws the page. The CSS is not changed; stylesheets from other sites, with `@import`, for print or with special attributes stay as they are. Never on cart, checkout or account pages. The files live in `wp-content/cache/admindra-turbo-css/`; turning the switch off gives back every link with the next page.
* Not offered, on purpose: deferring or delaying this site's own JavaScript, and removing CSS. On shops these break checkouts and menus more often than they help.
* Each page Turbo stores ends with an HTML comment naming AdMindra Turbo and the time it was stored. It has no link and visitors do not see it; the `admindra_turbo_signature` filter removes it.

= For developers and AI assistants =

* WP-CLI: `wp admindra-turbo status|enable|disable|clear|check|edge-check|findings|optimize|undo|set`.
* Abilities (WordPress Abilities API, for MCP clients such as AdMindra MCP): `admindra-turbo/report`, `admindra-turbo/status`, `admindra-turbo/findings` and `admindra-turbo/page-check`. All need an administrator. None of them changes files, code or settings.
* "Copy report for AI" on the Overview: one text for ChatGPT or Claude with the page check, the findings, the rules to follow, the tools this site has for each change, how each is undone, and a plan in order of effect. Turbo has no AI of its own and sends the report nowhere. The same text is `admindra-turbo/report`. It holds versions, settings, counts, plugin names and image addresses: no content, users, orders, keys or tokens.

= About AdMindra =

AdMindra Turbo is made by [AdMindra](https://admindra.com/), a Swedish AI platform from 3on Reklambyrå & Webbyrå AB that helps companies with advertising, sales, websites and visibility. Turbo is free and stays free, with no account. The Overview ends with "More from AdMindra": MindraNotes, AdMindra Node, AdMindra MCP (let ChatGPT or Claude work on your site) and AdMindra itself, then the add-ons AdMindra Turbo Pro and AdMindra MCP Maintenance from admindra.com. It is shown only on Turbo's own screen, never elsewhere in wp-admin, loads nothing from outside (its pictures ship with the plugin), sends nothing and links without tracking parameters, and each administrator can fold it into one line with "Hide".

== Installation ==

1. Install and activate the plugin. Nothing changes yet.
2. Open AdMindra Turbo in the admin menu and click "Run page check".
3. Click "Turn on page caching" under Page cache. If `WP_CACHE` is missing, Turbo adds `define( 'WP_CACHE', true );` to `wp-config.php`, checks that the site still answers (and puts the file back if it does not), and takes the line out again when you deactivate Turbo. Where `wp-config.php` cannot be written, Turbo tells you the line to add. If a cache plugin you no longer use left its `advanced-cache.php` behind, the button reads "Take over the page cache" and first moves that file aside as a backup; a file Turbo cannot name, or one whose plugin is still active, is never touched.
4. Click "Optimize safely". It turns on the page cache (setting it up as in step 3 when needed) and the class 1 switches, and tells you what it turned on. Undo is next to it.
5. On a shop: after "Optimize safely", put a product in a cart and check out with a test order to see that prices and stock are right.

== Frequently Asked Questions ==

= Why was a page not cached? =

Every response carries `X-AdMindra-Turbo: HIT`, `MISS` or `BYPASS <reason>`, and the page check shows it per page. "BYPASS cookie" means the visitor had a cookie Turbo treats as personal; "woo_prices" means the page lists products while catalog caching is off.

= Does Turbo work with other cache plugins? =

No. Two page caches can serve two different copies. Turbo stays off while WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, WP Fastest Cache, FlyingPress, Cache Enabler, Breeze, Speed Optimizer, WP-Optimize, Hummingbird, Swift Performance, Comet Cache, NitroPack or the Cloudflare plugin is active, or another plugin's `advanced-cache.php` is installed, and says which one. Host caches it recognises (Kinsta, WP Engine and others) are shown too.

= Is Turbo faster than WP Rocket? =

We make no such claim. The method we will use to compare (the same site, the same pages, LCP, INP, CLS, TTFB, bytes, requests and cache hits at the origin and at the CDN) is published in the AdMindra repository, and a claim will follow measurements, not the other way round.

= Does it send data anywhere? =

Only if you connect Cloudflare (see External services). The page check, the edge check and refilling the cache request your own site's pages. Nothing is sent to AdMindra, and there is no tracking.

= Multisite? =

Not supported yet; the cache stays off on multisite.

= What happens when I deactivate or delete it? =

Deactivating removes Turbo's drop-in and every stored page at once. Deleting also removes its options and scheduled events. Another plugin's drop-in is never touched.

= How was this tested? =

On real WordPress sites in Docker: WordPress 7.1 with PHP 8.3 and MariaDB 11.4, WooCommerce 11, Storefront and Elementor over HTTPS, and WordPress 6.4 with PHP 7.4 for install, upgrade from 0.6.0, deactivation, uninstall and a core update to 7.1. Orders are placed through the shop's own checkout with cash on delivery (a test method that moves no money). Cloudflare is tested against a simulator of its documented behaviour; a real zone is tested before we claim more.

== External services ==

Turbo talks to one external service, and only after an administrator connects it.

= Cloudflare API =

Used to verify the API token you paste, find the Cloudflare zone for your site's host name, and purge the URLs of pages that changed (or the whole zone, when you click "Purge everything at Cloudflare", or after a full clear while edge mode is on).

* Sent: the API token (as a bearer token), your site's host name (to find the zone) and the URLs of your own pages to purge. Nothing about your visitors.
* When: when you connect the token, when you turn on edge mode or click "Purge everything at Cloudflare", and after a page changes while "Purge changed pages at Cloudflare" is on.
* The token is stored encrypted with your site's own keys and is never shown again. "Disconnect" deletes it.
* Service: https://www.cloudflare.com/ — terms: https://www.cloudflare.com/website-terms/ — privacy: https://www.cloudflare.com/privacypolicy/

= Your own site =

The page check, the edge check and refilling the cache request pages of your own site through WordPress's HTTP API. If your site is behind a CDN, those requests pass through it as a visitor's would. They carry no real cookies.

== Changelog ==

= 0.8.6 =
* An add-on can show its screen as one of Turbo's tabs and put its own suggestions, with a button to its screen, among Turbo's improvements. AdMindra Turbo Pro 1.0.6 does both.

= 0.8.5 =
* The page check also finds the trackers that inline code adds while the page loads (a Meta pixel, a Google Tag Manager container), so they can be chosen as scripts that wait, and counts them as waiting when AdMindra Turbo Pro 1.0.5 or later holds their host.

= 0.8.4 =
* The name says what Turbo is: AdMindra Turbo – Page Cache & Speed, Safe for WooCommerce.
* Merge stylesheets: one switch, and part of "Speed up the site" (Undo takes it back). On a WooCommerce shop with 71 stylesheets before the first paint, Lighthouse 13's mobile First Contentful Paint went from 10–12 s to 7–9 s in a replay of the real page, counting the files uncompressed; on a real server they are compressed, so the gain is larger.
* The page check no longer counts the scripts AdMindra Turbo Pro holds back as render-blocking or as third-party scripts still to delay.
* Stored pages end with an HTML comment naming AdMindra Turbo and the time they were stored.

= 0.8.3 =
* The main image a theme lazy-loads is now a one-click step on the Overview, and part of "Speed up the site" (Undo takes it back). After an update Turbo measures again by itself, so the step shows up without a click. Found on a live shop where 0.8.1 left it to be named by hand and the LCP stayed at 13 s.
* www and the bare name: once WordPress has been seen redirecting one to the other, Turbo's drop-in answers that same 301 before WordPress loads. On the shop it took 1.4 s and PageSpeed counted 2 s for it.

= 0.8.2 =
* The plugin calls itself AdMindra Turbo: in the admin menu, the screen's heading (with AdMindra's mark), the Plugins screen and the foot of its own screens. Turbo Pro's heading reads AdMindra Turbo Pro.
* "More from AdMindra" at the end of the Overview: who makes Turbo, MindraNotes, AdMindra Node, AdMindra MCP and AdMindra, then the add-ons Turbo Pro and MCP Maintenance, each marked Installed when it is. Only on Turbo's own screen; "Hide" folds it into one line per administrator, and uninstall removes that choice.

= 0.8.1 =
* "Copy report for AI": paste it into ChatGPT or Claude; connected through AdMindra MCP with AdMindra Turbo Pro, the assistant fixes what it says, one undoable step at a time, and measures before and after. Also the ability `admindra-turbo/report`.
* Main image per page: a lazy-loaded main image loads at once. On a WooCommerce shop with a lazy-loading theme, Lighthouse's mobile LCP went from about 20 s to about 7.5 s in a replay of the real page.
* The page check counts images a script lazy-loads and names the likely main image; a finding says so (class 2, never automatic). Rides on the 0.8.0 screen: the report box is on the Overview, the main images under Improvements.

= 0.8.0 =
* A new admin screen in three tabs: Overview (one answer at the top, three cards, at most three next steps), Improvements (one click, for a developer, switched on, and the measurements behind a click) and Settings (one form with sections and a save bar).
* Receipts are calm: a toast that says what happened, with Undo where it can be undone. Red is kept for what went wrong, in the words of whatever refused.
* Suggestions read as what you get ("Load the main image first"), and each one-click suggestion has its own Turn on.
* Everything still works without JavaScript; the screen loads only its own stylesheet and a small script, nothing from elsewhere.

= 0.7.2 =
* One click takes over the page cache: a file left behind by an inactive cache plugin (WP Rocket and 13 others) is moved aside as a backup, never deleted, and `WP_CACHE` is added to `wp-config.php`. Turbo then asks the site over a real request whether it still answers and reads the line, and puts both files back if not. Deactivating Turbo takes the line out again.
* Real shop themes are cached: a login box in the header (Woodmart and others), a newsletter form that posts to another site (Brevo, Mailchimp), the nonces of payment and wishlist plugins, and a Meta pixel plugin's server-set `_fbp` no longer keep every page out of the cache. Found on a live WooCommerce shop, where 0.7.1 cached no page at all.
* "Optimize safely" does the same setup, and on a shop where nothing makes prices depend on the visitor (geolocation, currency, member prices, coming-soon mode) it turns on catalog caching too. Undo turns it off. Abilities never do either. "Turn off" and deactivation take the line out again.
* Only from the buttons in the admin screen and `wp admindra-turbo enable`; never from an ability or a remote request.

= 0.7.1 =
* In Swedish: the whole plugin ships with a Swedish translation.
* When another plugin's advanced-cache.php is in the way, Turbo names the plugin it came from (read from the file itself), says whether that plugin is still active, and says what to do: delete the plugin or the file. Turbo still never replaces or deletes another plugin's file.
* The WP_CACHE step says where in wp-config.php the line goes.

= 0.7.0 =
* Tested on real WordPress, WooCommerce, Storefront and Elementor sites. 0.6.0 stored no pages there at all; 0.7.0 fixes every cause found.
* Page cache: search forms, WordPress's own Link headers, analytics cookies and tracking parameters no longer prevent caching; Elementor writing an option on every view no longer clears the cache; a post change removes only the pages that show it.
* WooCommerce Safe Mode: private pages found from the shop's own page settings, catalog caching as an opt-in with purges on stock and price changes, refusal where prices depend on the visitor, pages that list products follow the same rule.
* Cloudflare: edge check, optional API token (encrypted, least privilege) for purges, optional edge mode with a safety check, errors shown in Cloudflare's own words.
* Findings with risk classes, "Optimize safely" with Undo, page check across front page, post, shop and product.
* New admin screen with Overview, Performance, Optimizations, Compatibility and Settings.
* WP-CLI commands and Abilities for MCP clients.
* AVIF for new uploads where the server supports it.
* Fixes: the drop-in now takes effect at once under OPcache; comment counts purge their post.

= 0.6.0 =
* Developer beta: a manual cache delivery probe, MISS diagnostics, hardened cache reads.

= 0.5.0 =
* WebP for new JPEG uploads (opt-in), Google Fonts preconnect, homepage resource audit.

= 0.4.0 =
* Cloudflare APO coexistence, CDN opt-out headers, canonical host checks, cache generations.

= 0.3.0 =
* Stricter response checks, form and nonce refusal, atomic drop-in installs, language-separated copies.

= 0.1.0 =
* First developer beta.

== Upgrade Notice ==

= 0.8.6 =
Turbo Pro shows as a tab in Turbo.

= 0.8.5 =
The page check finds the Meta pixel and Google Tag Manager added by inline code.

= 0.8.4 =
Merges the site's own stylesheets into one file, the largest render-blocking item on many shops.

= 0.8.3 =
The main image loads at once with one click, and the www redirect no longer waits for WordPress.

= 0.8.2 =
The name AdMindra Turbo throughout, and a short "More from AdMindra" on the Overview that you can hide.

= 0.8.1 =
A report you copy into ChatGPT or Claude, and a lazy-loaded main image that loads at once.

= 0.8.0 =
A calmer, simpler admin screen: one status, one button, and the details a click away.

= 0.7.2 =
Pages of real shop themes are cached now, and the page cache turns on in one click, also where an old cache plugin left its file behind or WP_CACHE is missing.

= 0.7.1 =
Swedish translation, and a clearer next step when another cache plugin's file blocks the page cache.

= 0.7.0 =
Pages are actually cached on WooCommerce, Storefront and Elementor sites now. Stored pages from 0.6.0 are cleared on upgrade.
