Page Cache
Fast pages for real visitors, and never a cached page for a bot.
A page cache saves a ready copy of each page. The next visitor gets this copy at once, and WordPress does not have to build the page again. This makes your site much faster and takes load off your server.
A normal cache plugin has one problem with BotBlocker: it sends the saved copy to anyone, before BotBlocker can check the visitor. Page Cache is built into BotBlocker, so it works with the protection instead of around it:
- A visitor BotBlocker has verified gets the cached page. The visit is fast.
- A bot or an unverified visitor never gets a cached page. They get a fresh page, and BotBlocker checks them first, as usual.
- Check pages, block pages and "access denied" pages are never saved. A visitor can never get another visitor's check page from the cache.
Open it from BotBlocker → Add-ons → Page Cache.
It needs Early Init
Page Cache decides who may get a cached page with the gate of the Early Init add-on. So it works only when:
- Early Init is on, and
- Cached pages for verified visitors is on in the Early Init settings.
Until then, the panel shows a warning with a link to the Early Init settings, and the Enable Page Caching switch is locked. Once the gate is ready, a green note under the add-on description links to the Early Init settings. Early Init needs a PRO license, so Page Cache needs one too.
If the gate goes away later, for example because you turn Early Init off, Page Cache pauses by itself. It removes its cache file from WordPress and deletes all saved pages, so no page can reach a visitor without a check. When the gate is back, Page Cache starts again.
Use only one page cache
Turn off any other page cache plugin before you turn Page Cache on. Two page caches on one site get in each other's way.
If another cache plugin still owns the WordPress cache file, Page Cache still works, but slower: it sends cached pages a little later, after the BotBlocker check, instead of at the very start of the visit. The panel shows a warning in this case. Turn off the other plugin, remove its cache file, and save the Page Cache settings again for the fastest mode.
Status
The Status group shows if the cache is ready. A green dot means good, an amber dot means something is missing, and a red dot means the cache cannot work.
| Line | Good value | Meaning |
|---|---|---|
| Page Cache | Enabled | Caching is on. Paused means it is on, but the Early Init gate is off. |
| Early Init Cache Gate | On | Early Init can check visitors before a cached page is sent. |
| advanced-cache.php | Installed | BotBlocker's cache file is in place. Owned by another plugin means another cache plugin has it. |
| WP_CACHE | On | WordPress loads the cache file. BotBlocker adds this line to wp-config.php for you. |
| Cached Pages | A number above 0 | How many pages are saved, and how much space they use. |
Below the lines you see the folder where the pages are saved.
Purge and preload
- Purge cache deletes all saved pages. The next visit to each page builds and saves it again.
- Preload cache fills the cache in the background, so the first real visitor already gets a fast page. It visits your home page and your newest posts and pages. Pages that are already saved and still fresh are skipped. With a Cache Lifespan of 0, every preload rebuilds all pages. Preload requires Page Cache and the Early Init cache gate to be enabled. If the cache is paused, a notice explains what to enable and no new preload is queued.
When you are logged in, the admin bar at the top of your site also has a Page Cache menu:
- Purge all cached pages deletes all saved pages.
- Purge this page deletes only the page you are looking at.
Your cache stays up to date
You do not need to purge by hand after a normal change. Page Cache deletes the pages that a change touches:
- You publish, update, unpublish or delete a post or page: that page, the home page, its categories and tags, its author page, its date archives and the posts next to it.
- You change the address of a post: the old address too.
- Saving a static front page clears the home page and its pagination while keeping other cached pages, including on subdirectory installs and multisite subsites.
- A comment is added, changed or moderated (when Purge On New Comment is on).
- You change categories or tags, the front page, the posts page or the number of posts per page.
Some changes touch every page. Then Page Cache deletes all saved pages: a new theme, a menu or widget change, a plugin turned on or off, an update, a new site title or tagline, or a change of the permalink settings.
Pages also expire by themselves after the Cache Lifespan. A cleanup task deletes old pages in the background, even pages nobody visits.
Who never gets a cached page
Page Cache always sends a fresh page to:
- Logged-in users, and visitors who left a comment or opened a password-protected post.
- Shoppers with items in their cart, and visitors who picked another currency in a shop.
- Visitors who are not verified yet, or bots.
- Requests that are not a normal page view: forms that send data, the WordPress login, search results, feeds, previews, and "page not found" pages.
- Any address, cookie or browser from your Exclusions lists.
A page that fails while it is built is never saved. So a visitor never gets an error page from the cache.
Multisite
On a network, you manage Page Cache on the main site. The settings apply to every site. On the other sites, the panel shows a warning, and changes there are not used.
A change on one site deletes only that site's pages. Purge cache and Purge all cached pages delete the pages of the site you are on. Saving the settings deletes the pages of all sites.
Settings
Page Caching
Enable Page Caching
Default: Off
The main switch. When you turn it on, BotBlocker puts its cache file in place and adds the cache line to wp-config.php. When you turn it off, BotBlocker removes them again.
The switch is locked until the Early Init gate is ready. See It needs Early Init.
Cache Lifespan
Default: 24 hours
How long a saved page is used. After this time, the next visit builds the page again. Set 0 to keep pages until they are purged or rebuilt by Preload cache.
- Shorter: changes that Page Cache cannot see, for example from another plugin, show sooner. More visits build pages.
- Longer: more visits are fast. Content from other plugins can stay old for longer.
Store Gzip Copies
Default: On
Saves a compressed copy of each page next to the normal one. Browsers that can read compressed pages (almost all of them) get the smaller copy, so pages load faster. Turn it off only if your server already compresses pages and you see problems.
Separate Mobile Cache
Default: Off
Saves a second copy of each page for phones and tablets. Turn it on only if your theme shows different content on mobile devices. Most modern themes show the same page and adapt it with CSS, so they do not need this.
Purge On New Comment
Default: On
Deletes the saved post page when a comment is added, changed or moderated, so new comments show at once. Turn it off on a site with many comments if you can accept that new comments show only after the Cache Lifespan.
Add Cache Comment
Default: On
Adds a short note with the time the page was saved at the very end of each saved page. Visitors do not see it. It helps you check in the page source that a page came from the cache.
Exclusions
Never Cache URLs
Default: empty
Addresses that are never saved and never sent from the cache. Full URLs and paths are accepted, for example https://example.com/cart/, /cart or /checkout/*. Write one address per line. Only the path is matched; the scheme and host are ignored. A * matches any text. /shop/* matches child pages, but not /shop/ itself.
Add here pages that show something personal, for example a shop cart, a checkout or a member area, if your shop plugin does not protect them on its own.
Never Cache With Cookies
Default: empty
A visitor with a cookie whose name contains one of these words always gets a fresh page. Write one word per line. The login, comment and password cookies of WordPress are always excluded, you do not need to add them.
Never Cache For User Agents
Default: empty
Browsers or tools whose name (user agent) contains one of these words always get a fresh page. Write one word per line. Upper and lower case do not matter.
Cacheable Query Parameters
Default: empty
An address with a ? part (a query, for example ?color=red) is normally not saved, because the page can be different for each query. Add a parameter name here, one per line, to save pages with that parameter too.
Tracking parameters from ads and newsletters, for example utm_source, gclid or fbclid, are ignored by themselves. Such a visit gets the normal cached page.
Server rules for nginx
On Apache, LiteSpeed and IIS servers, BotBlocker protects the cache folder with a rule file, so nobody can open a saved page directly. nginx does not read these files. The folder has a random name, so it is hard to guess, but for full protection ask your host to add this rule to your nginx configuration:
location ~* ^/wp-content/cache/bbcs-page-cache-[a-f0-9]+/ {
deny all;
}If something does not work
- The switch is locked? Turn on Early Init and its Cached pages for verified visitors setting. See It needs Early Init.
- The status shows "Paused"? The Early Init gate is off. Turn it on again, and caching starts again by itself.
- WP_CACHE stays "Off"? BotBlocker cannot change
wp-config.phpon your server. The admin area then shows a notice. Ask your host to make the file writable, or to adddefine( 'WP_CACHE', true );to it. - The admin area shows a notice that Page Cache cannot write a file or folder? Your server does not allow BotBlocker to change it. Ask your host to fix the file permissions.
- "Owned by another plugin"? Another cache plugin is still installed. See Use only one page cache.
- Visitors never get cached pages? The first page after a check is never sent from the cache; caching starts from the next page. Logged-in users never get cached pages, so test in a private window.
- A page shows old content? Use Purge this page in the admin bar, or Purge cache in the panel.
- A page shows personal content to the wrong visitor? Add the page to Never Cache URLs, then purge the cache.
- You turned Page Cache off, but pages still look cached? Your server, host or CDN may have its own cache. Clear it there.