Without a cache, WordPress builds every page from scratch on every visit: it loads PHP, runs every plugin and the theme, and asks the database dozens or hundreds of questions. The page cache saves each finished page as ready-made HTML, so the server can answer the next visitor in a few milliseconds. For most sites it is the single biggest speed gain available, and it also lets the same server handle many more visitors.
On our own site, a page built by WordPress takes about 0.74 seconds to the first byte; the same page from Keel’s cache takes about 0.10 seconds, most of which is the network.
Before you start
- Is your host already caching? Some managed WordPress hosts cache pages themselves. Keel recognises the common ones and tells you on the Caching screen. If your host caches, leave Keel’s page cache off and use Keel’s other caching features.
- Do you use another cache plugin? Use one page cache, not two. Deactivate the other one first, or leave Keel’s off.
Turn it on
- Open Keel › Caching › Page cache.
- Switch on Cache pages and save.
- Keel writes a small drop-in file and, if needed, the
WP_CACHEline inwp-config.php. If either cannot be written, the screen says what to do.
What is never cached
- Logged-in users, including you. You always see the live site.
- Carts, checkouts and account pages, and visitors with something in their cart.
- Form submissions and anything that is not a normal page view.
- Addresses with query strings, except tracking parameters like
utm_sourceandgclid, which are ignored. - Addresses you add to Never cache addresses starting with, separated by spaces, for example
/my-account /members /quote. - Error pages and pages that set cookies for the visitor.
When the cache clears
The cache clears itself whenever you publish or edit content, change menus, widgets or settings, or a comment is approved. You never have to remember to clear it after editing.
Pages are also rebuilt after Keep pages for (hours). Ten hours is a good default: WordPress forms contain a security token that is only valid for a limited time, and a page cached for days could contain an expired one.
Check that it works
- Open a page in a private browser window, so you are not logged in.
- Reload it. The second load should feel instant.
- Open the browser’s developer tools (F12), Network tab, click the page request and look at the response headers:
X-Keel-Cache: HITmeans it came from the cache;MISSmeans it was just built and saved. - Submit a contact form and, on a shop, add something to the cart, to make sure personal pages behave.
Rebuild in the background (Keel Pro)
After the cache clears, the first visitor to each page waits for it to be built. With Rebuild the cache in the background, Keel visits your own pages after a clear, so they are ready before real visitors arrive. It also runs once a day. See rebuild the cache in the background.
Common problems
| Problem | Fix |
|---|---|
| Changes do not show for visitors | Another cache (your host or a CDN) is still serving the old page. Clear it there, and use only one page cache. |
| A form says the session expired | Lower Keep pages for (hours), or exclude that page. |
| A page shows something personal to the wrong person | Add the page to Never cache addresses starting with. |
| Status says the cache is not active | The drop-in or WP_CACHE line could not be written. Follow the instructions on the screen, or ask your host about file permissions. |
Every setting on this screen
The same explanations you see next to each setting in Keel.
Keel › Caching › Page cache
| Setting | What it does |
|---|---|
| Cache pages | Visitors get a saved copy of each page. Logged-in users, form submissions, carts and checkouts are never cached. The cache clears itself whenever you save content, menus or settings. |
| Keep pages for (hours) | After this a page is rebuilt on the next visit. 10 hours keeps form security tokens valid. |
| Never cache addresses starting with | Separated by spaces. Add pages that show something different for every visitor. |
| Rebuild the cache in the background (Pro) | After the cache is cleared, the site visits its own pages so they are cached again before real visitors arrive. Runs again once a day. Pages hidden from search engines are skipped. |
| Pages per minute | Lower this on small hosting plans. 10 rebuilds 600 pages an hour without being noticed. |