=== Fastless Cache - Speed Up Your Site ===
Contributors: appscreo
Tags: cache, caching, pagespeed, woocommerce, elementor
Requires at least: 6.0
Tested up to: 7.2
Requires PHP: 7.0
Stable tag: 1.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Speed up your site with Fastless Cache. Pages are served as static HTML before WordPress loads, so repeat visits skip PHP and the database. Install it and start caching.

== Description ==

Fastless Cache does one job: it makes your site fast.

When someone visits a page, Fastless Cache saves it as a static HTML file. The next visitor gets that file right away, before WordPress boots up or your theme and plugins run. That is where the speed comes from.

Page speed matters. Faster pages keep people on your site and help your Core Web Vitals. Fastless Cache builds the HTML once, then skips PHP and the database on every cached request. The next visitor gets the page immediately.

There is no setup wizard and no wall of options to get wrong. Install it, activate it, and it starts caching. The defaults are the ones most sites want, and you only open the settings if you feel like fine-tuning something.

**Fast by default**

* Pages are served from a static file, before WordPress loads
* Cache hits skip the database and PHP completely
* Optional gzip and Brotli compression
* Optional separate cache for mobile visitors
* Repeat visits get a quick "not changed" reply instead of the whole page again

**Faster next page, measured**

* Optional Speculation Rules prefetch or prerender the page a visitor is likely to open next. Off by default; on WordPress 6.8 and later it configures WordPress's own rule instead of adding a second one.
* The Dashboard measures the homepage uncached and cached, then shows the time and percentage saved, with a Re-measure button.

**Speculation Rules**

With Speculation Rules turned on, the browser prepares the page a visitor is most likely to open next while they are still reading the current one. In **Prefetch** mode it downloads that page quietly in the background; in **Prerender** mode it downloads and renders it too, so the navigation is already done before the click. Either way the next page appears at once instead of waiting on a fresh request. It is safe because the pages it fetches are static files that are already cached, and you choose how early it acts: **Conservative** waits for a hover or keyboard focus, **Moderate** starts a little sooner, and **Eager** prepares links as soon as the page loads.

Admin screens, the REST API, XML-RPC, logged-in visitors and query-string links such as add-to-cart are always left out, and you can add `no-prefetch` or `no-speculation` to any link to opt it out. On WordPress 6.8 and later, Fastless Cache applies your mode and eagerness to WordPress's own built-in rule instead of printing a second one, so the two never overlap. The feature is off by default, and changing it clears the site cache so the new rule takes effect on the next visit.

**It looks after itself**

Caching is only useful if it stays fresh, so Fastless Cache clears the right pages for you. Publish or edit a post, approve a comment, change a term, update a user, and the affected pages are cleared automatically. You decide which of those should trigger a clear. There is also a Clear button in the admin bar and on the dashboard, plus a WP-CLI command for when you would rather stay in the terminal.

**WooCommerce**

WooCommerce stores are handled with care. Cart, checkout and my-account pages are never cached, so shoppers always get a live, correct page. Account endpoints, the order-received page and the order-pay page are left alone too. When a product or its stock changes, the affected pages are cleared for you. And if your theme updates the cart with WooCommerce's own AJAX fragments, you can choose to cache pages for shoppers who already have items in their cart.

**Elementor**

Fastless Cache is made to work tightly with Elementor. The editor and preview screens are never cached, so unpublished content can't leak out through the cache. Save a template or a global widget, or let Elementor regenerate its CSS, and the cache is cleared for you. It is on by default, and you can switch it off on the General tab if you would rather manage it yourself.

**Query strings**

Your campaign links keep working. Tracking parameters such as UTM tags, gclid and fbclid are ignored, so a link with tracking still lands on the cached page. Run a shop or a filtered listing? Turn on "Cache with query strings" and give sort, filter and pagination their own cached versions, so each one is fast too.

**Cookies**

Some visitors arrive with cookies. Login, password-protection and comment-author cookies always bypass the cache, so a logged-in user never sees a stale page. If your site uses other cookies to show different content, you can list the ones that should bypass the cache, or the ones that deserve their own cached copy.

**CDN**

Everything CDN-related lives on one screen. Turn on **Enable CDN** and choose **Custom CDN** or **Bunny.net CDN**. Fresh installs start on Custom CDN. CDN stays off until you switch it on, and changing the effective provider or hostname clears the page cache automatically so pages are regenerated with the right URLs.

**Bunny.net CDN**

Fastless Cache can serve static files through a Bunny.net pull zone and purge that zone when Fastless Cache clears its page cache. You need a Bunny.net account and a pull zone for this site. Bunny.net service is separate from the free Fastless Cache plugin.

**Exclusions and extras**

* Exclude post IDs and page paths, with * wildcards
* Cache preload from the dashboard, run in small background batches with resumable progress
* Export and import your settings as JSON
* Full multisite support
* A clean uninstall that removes the drop-in, the .htaccess rules, the WP_CACHE constant and every cache file it created

The drop-in only ever deletes an advanced-cache.php file it owns, so uninstalling Fastless Cache can never remove another plugin's drop-in.

== Installation ==

1. Upload the plugin to wp-content/plugins/fastless-cache, or install it from the Plugins screen.
2. Activate it. Fastless Cache creates the advanced-cache.php drop-in and sets WP_CACHE in wp-config.php for you.
3. Make sure your site uses a custom permalink structure (Settings → Permalinks). Plain permalinks are not supported.
4. Open any page and look for the X-Cache-Handler: fastless-cache-engine response header. If it is there, the cache is running.

If the plugin can't write wp-config.php or create the drop-in itself, it tells you in the admin area and shows you the manual steps.

= Quick setup =

1. Open **Fastless Cache → CDN**, turn on **Enable CDN** and choose **Bunny.net CDN**.
2. Create an API key in the Bunny.net Dashboard under **Account → API**. Paste it into the **API key** field and click **Test**.
3. Select the **Pull zone** for this site and click **Save changes**. Fastless Cache fills in the hostname and uses it for CDN URLs.

A saved key, zone or provider selection does not enable CDN rewriting. **Enable CDN** is the master switch.

= Connection and security =

After a successful Test, the panel reports **Connected with Bunny.net**, hides the key field and offers **Disconnect**. Disconnect clears the key, pull zone, hostname and provider selection, then returns to Custom CDN. Your manually entered CDN settings are kept. Settings exports never contain the API key.

Database-stored connections must be retested every 24 hours to keep the connected state and Dashboard statistics. Automatic purging continues while the saved key remains valid. Keys supplied by `FASTLESS_CACHE_BUNNY_API_KEY` do not need retesting.

You can define `FASTLESS_CACHE_BUNNY_API_KEY` in `wp-config.php` instead of storing the key in the database. The constant takes precedence, the panel reports **Connected via configuration**, and there is no Disconnect button. Remove or update the constant in `wp-config.php` to change it.

The integration sends API requests only to `api.bunny.net`. It does not send telemetry or analytics.

= Purging and cache freshness =

Use **Purge CDN cache** to clear the whole pull zone, or use the **Purge site URL** field and **Purge URL** button to purge one exact CDN URL. The URL field accepts a normal URL on your site or a root-relative path and maps it to the zone hostname. The zone can also be purged from the Bunny.net item in the WordPress admin bar or through WP-CLI.

Turn on **Purge when clearing** to request a full-zone purge whenever Fastless Cache clears its page cache. Bunny.net API failures do not block the local cache clear, and rate-limited requests are retried automatically.

= Edge caching and statistics =

Set **Edge TTL (seconds)** and **Stale-while-revalidate (seconds)** to control the cache headers added to cached-page responses. A TTL of `0` leaves the Bunny.net zone setting in effect. Both values are capped at 365 days, and no edge-cache override is sent while cookie caching is enabled.

When CDN is enabled and Bunny.net is connected, the Dashboard shows pull-zone bandwidth, cache hit rate and requests served. The CDN screen warns if Perma-Cache prevents cache-tag purging or Bunny Optimizer may double-optimize images. Cache-tag purging remains available through WP-CLI.

= Multisite =

Each site keeps its own Bunny.net configuration, unless a shared `FASTLESS_CACHE_BUNNY_API_KEY` constant supplies the key. A network-wide clear purges every site that has **Purge when clearing** enabled.

== Frequently Asked Questions ==

= Do I need to configure anything? =

No. Activate it and it caches. Every setting has a sensible default, so the settings screen is there for the times you want to change something, not because you have to.

= Will Fastless Cache speed up my site? =

Yes. Every cached page is served as a static HTML file before WordPress boots, so repeat visits skip PHP and database work. The speed up is most noticeable on shared or low-power hosting.

= Is it safe to use with WooCommerce? =

Yes. Cart, checkout, my-account and account pages are never cached, and those paths are remembered, so even the first request (before WordPress loads) bypasses the cache. Product and stock changes clear the affected pages. Easy Digital Downloads checkout, success and purchase-history pages are excluded too.

= Does it work with Elementor? =

Yes, and it is built to. Editor and preview requests are never cached, and saving a template or a global widget, or regenerating Elementor's CSS, clears the cache. The integration is on by default.

= Are logged-in users served cached pages? =

No. The login, password-protection and comment-author cookies always bypass the cache, no matter what you configure.

= Does it cache query strings? =

Only the ones you choose. Tracking parameters are ignored, so campaign links still hit the cache. Turn on "Cache with query strings" to give sort, filter and pagination their own cached pages.

= How do I clear the cache? =

From the Fastless Cache menu in the admin bar, the Clear cache button on the dashboard, or WP-CLI (see below).

= Does preloading work on low-power hosting? =

Yes. Preloading runs in short, time-boxed batches from the dashboard, so no single request comes close to your host's time limit, and it does not need WP-Cron.

= Does it work with Redis or Memcached object caches? =

Yes. An object cache drop-in (`object-cache.php`) and page caching are different layers and work together. On a cached page hit, Fastless Cache serves the HTML before WordPress loads, so the object cache is not even started. On a cache miss, your object cache speeds up the dynamic request as usual. Fastless Cache never creates, replaces or deletes your `object-cache.php` file.

If you enable an additional query cache inside Fastless Cache while an external object cache is active, the plugin shows a warning because two query caches with separate invalidation can serve stale content. In that case keep the one you need; Fastless Cache does not touch the external drop-in.

= What does the Bunny.net integration send to Bunny.net? =

The integration sends configured API requests only to api.bunny.net, using the API key you provide. It does not send telemetry or analytics.

= Does it work with Nginx? =

Yes. Cached pages are served by PHP, so it works on any server that runs WordPress. The optional .htaccess rules for browser caching and compression are Apache-only, and are quietly skipped everywhere else.

= Can I move my settings to another site? =

Yes. Tools → Export gives you your settings as JSON, and Tools → Import restores them on any other site running Fastless Cache.

== WP-CLI ==

You can also manage the cache from the command line.

= wp fastless-cache bunny purge [--purge-url=<url>] [--tag=<tag>] =

Purge the selected Bunny.net pull zone, one URL on its hostname, or one cache tag. Use at most one of --purge-url or --tag. Do not use --url for a CDN URL: WP-CLI reserves it for selecting the WordPress site.

## OPTIONS

[--purge-url=<url>]
: Purge one URL on the selected pull-zone hostname.

[--tag=<tag>]
: Purge content with the given cache tag. Unavailable when the zone has Perma-Cache enabled.

## EXAMPLES

    # Purge the selected pull zone.
    $ wp fastless-cache bunny purge

    # Purge one URL or cache tag.
    $ wp fastless-cache bunny purge --purge-url=https://cdn.example.com/path
    $ wp fastless-cache bunny purge --tag=product-42

= wp fastless-cache clear =

Clear the page cache.

## OPTIONS

[--ids=<id>]
: Clear the cache of a given post ID. Separate multiple IDs with commas.

[--urls=<url>]
: Clear the cache of a given URL. The URL can be with or without a scheme, and can include a wildcard path and a query string. Separate multiple URLs with commas.

[--sites=<site>]
: Clear the cache of a given blog ID (multisite). Separate multiple blog IDs with commas.

## EXAMPLES

    # Clear the whole page cache.
    $ wp fastless-cache clear
    Success: Site cache cleared.

    # Clear the cache of post IDs 1, 2 and 3.
    $ wp fastless-cache clear --ids=1,2,3
    Success: Pages cache cleared.

    # Clear the cache of https://www.example.com/about-us/.
    $ wp fastless-cache clear --urls=www.example.com/about-us/
    Success: Page cache cleared.

    # Clear the cache of any URL that starts with https://www.example.com/blog/how-to-.
    $ wp fastless-cache clear --urls=www.example.com/blog/how-to-*
    Success: Page cache cleared.

    # Clear the cache of https://www.example.com/blog/ and all of its subpages.
    $ wp fastless-cache clear --urls=www.example.com/blog/*
    Success: Page cache cleared.

    # Clear the cache of sites with blog IDs 1, 2 and 3 (multisite).
    $ wp fastless-cache clear --sites=1,2,3
    Success: Sites cache cleared.

== Screenshots ==

1. Fastless Cache Settings
2. Fastless Cache Settings
3. Fastless Cache Settings
4. Fastless Cache Settings
5. Fastless Cache Settings
6. Fastless Cache Settings
7. Fastless Cache Settings

== Changelog ==

= 1.5 =

* Speculation Rules: a new optional Speculation Rules tab prefetches or prerenders the page a visitor is likely to open next. It is off by default. On WordPress 6.8 and later it applies the mode and eagerness to WordPress's own rule instead of printing a second one, and changing the setting clears the site cache so the new rule takes effect.
* Load improvement: the Dashboard measures the homepage uncached and cached, then shows the time and percentage saved, with a Re-measure button.
* Startup diagnostics: the Dashboard shows a compact status card, and a dedicated Status tab lists startup checks with their result, details, scope and available fix. Preload readiness is shown as informational status in the table and is not counted among the nine required checks.
* Automatic WP_CACHE repair: the Status tab can enable a false WP_CACHE define in wp-config.php, with a protected backup, PHP syntax validation, byte-offset-safe edits and rollback on failure. Defines in plugin or theme PHP and foreign drop-ins are never overwritten.
* Preload reliability: preloads refuse to start while caching is inactive, stale locks can be cleared, a cache clear no longer kills a running preload, status and queue writes report failures, and the Status tab shows the last run's summary and log lines.
* Custom login, password and comment cookie names are now bypassed, and logged-in visitors are never served cached pages once WordPress has loaded.
* Fixed release-review findings: multisite uninstall cleans options for every site, the Bunny.net fingerprint invariant is symmetric, plugin row metadata is preserved, empty-constant and CLI argument handling are safer, and the false-glob guard no longer calls unlink on an invalid path.

= 1.4 =

* New startup diagnostics: the Dashboard shows a Diagnostics card with failing checks, and a Status tab lists every check with its result, details, scope and an available fix. Checks cover WP_CACHE, drop-in ownership, the settings revision, writable directories, conflicting caches, permalinks, index-file protection, minification overlap and preload readiness.
* Automatic WP_CACHE repair: the Status tab can enable WP_CACHE in wp-config.php with a marked, guarded block. It writes a timestamped backup into a protected settings directory (kept for 30 days and excluded from settings exports), checks PHP syntax and restores the original on failure. Defines in plugin or theme PHP and foreign advanced-cache.php drop-ins are never overwritten.
* Preload reliability: preloads now refuse to start while caching is inactive, stale locks are detected and can be cleared, queue state and progress survive a reload, and the Status tab records the last run's counts and log lines so stalls and failures can be diagnosed.
* Bunny.net integration: select a pull zone, derive its CDN hostname, purge the CDN cache automatically or on demand, purge URLs or cache tags, set edge TTL headers and view statistics.
* CDN and Bunny.net are strictly opt-in: a stored key, zone, hostname, or inferred provider never enables rewriting or edge headers. Upgrades preserve explicit prior opt-in and switch inferred-only sites off once.
* CDN settings are consolidated on one screen: a Custom CDN / Bunny.net CDN provider selector, Test to connect and Disconnect to reset, a "Purge site URL" field that accepts a normal site URL, and pull-zone statistics on the Dashboard. Cache-tag purging is no longer offered in the settings UI (the WP-CLI flag remains).
* Works alongside Redis, Memcached and other object-cache plugins. Fastless no longer shows a false "only one cache plugin" conflict, and it never modifies their drop-in files.
* If you also enable our optional query cache while an object cache is active, a notice explains the overlap and recommends keeping just one query cache.
* Cache-clear requests are contained to the plugin's own cache folder: path traversal is rejected, whole-segment and documented partial wildcards are supported, and an explicit clear request takes priority over URL arguments.
* Configuration edits are safer and upgrade-friendly: the WP_CACHE constant and .htaccess rules use markers, older installs are still recognised, and removal handles different line endings.
* Response headers are hardened, and cached pages negotiate compression correctly. `br;q=0` and `gzip;q=0` are respected, quality values choose the preferred encoding, pages are never compressed twice, and 304 responses include `Vary`.
* Preloading scales better: batches are time-boxed, the URL queue uses a crash-safe cursor instead of rewriting the whole list per page, each site in a multisite network keeps its own state, paused runs resume from the dashboard, and only pages actually stored or served from cache count as successes.
* Large HTML pages fail open when CDN rewriting cannot complete, so a regex limit never prevents the page from being cached.
* Multisite Bunny.net auto-purges and retries target every originating site and pull zone.
* Saving Advanced Custom Fields values now clears the cache correctly, while autosaves, revisions and imports no longer trigger unnecessary cache clears.
* Added a plain-language note: object caching only helps when the database is the bottleneck. A dedicated Redis/Memcached plugin is the right tool, and it coexists with Fastless page caching.
* Bundled translations for 16 languages: Spanish, Japanese, German, French, Portuguese (Brazil and Portugal), Italian, Dutch, Russian, Simplified Chinese, Polish, Turkish, Korean, Swedish, Bulgarian and Romanian.
* The dashboard status now separates a ready cache from one that is still initializing after activation, and shows a reload hint while the WP_CACHE constant is not yet visible. Conflicts and setup failures keep the red error state.

= 1.3 =

* New CDN tab: serve static files (images, CSS and JS) from a CDN hostname. Off by default; clear the cache after enabling so pages are regenerated with CDN URLs.

= 1.2.2 =

* First public release.

== Upgrade Notice ==

= 1.5 =

Adds startup diagnostics, a one-click WP_CACHE repair, a homepage load-improvement measurement and an optional Speculation Rules setting. No action is needed; if the Status tab reports a blocker, use its Fix button before starting a preload. Speculation Rules is off by default.

= 1.4 =

Works alongside Redis/Memcached object caches. Explicit CDN opt-in is preserved on upgrade; Bunny configuration without a prior master opt-in is switched off and its rewritten cache is cleared once. No action is needed unless you want to enable CDN.

= 1.3 =

New CDN tab, off by default. Enable it and clear the cache to serve static files from your CDN.

= 1.2.2 =

First public release.
