On every visit, WordPress builds the page again: it runs PHP, reads the database and puts the pieces together. A caching plugin keeps the finished page and sends it straight to the next visitors. The page opens faster, and your account uses less CPU and memory.
What you'll achieve
- turn on page caching, with settings that don't break the website;
- know which pages must never be cached;
- clear the cache after a change and check that it works.
Three kinds of cache
| Kind | Where it lives | What handles it |
|---|---|---|
| Page cache | on the server, in your account | a caching plugin |
| Browser cache | on the visitor's computer: CSS, JavaScript, images | the headers sent by the server, from the plugin or from .htaccess (see Slow website: what to check, in order) |
| CDN cache | on the servers of a service such as Cloudflare | that service (see Cloudflare in front of your website: when it helps and how to set it up) |
For a typical website, the page cache makes the biggest difference.
Before you start
- Back up the website: in Enhance, on the website's page, go to the “Backups” tab » “Create backup” (with the language set to “English (US)”, “Backup now”).
- Measure the current speed, so you know whether it helped: write down the PageSpeed Insights result (see Core Web Vitals explained: LCP, INP and CLS).
- Only one caching plugin. If you already have one, don't install a second: they conflict and can serve broken pages. Some themes and page builders have their own cache; check their settings first.
- How to choose a trustworthy plugin: The plugins a WordPress website needs.
The steps
Turn on page caching
- Install and activate the caching plugin you chose, from Plugins » Add New Plugin (wp-admin/plugin-install.php).
- In its settings, turn on page caching (usually labeled page cache). To start, leave everything else at the default values.
- Make sure logged-in users are excluded (the logged-in users option): you must always see the real website, not a cached copy.
- If you run a store, check the exclusions for the cart, checkout and customer account (in WooCommerce: the Cart, Checkout and My account pages). Reputable plugins exclude them automatically. If these pages end up in the cache, one customer may see another customer's cart.
- Save, then open the website in a private window, twice: the second time, the page comes from the cache. Many plugins leave a comment at the end of the page code (right-click » View page source) or a header saying the page was served from the cache.
Extra options, one at a time
Caching plugins have other options too: combining and minifying CSS and JavaScript files (minify, combine), deferring scripts (defer), lazy loading images. They help, but they are also the most common cause of broken pages.
- Turn on one option only.
- Clear the cache and check the home page, the menu on a phone, the forms and, if you have one, the cart.
- If something looks wrong, turn the option off and move on to the next one.
Clear the cache after a change
- After you edit a page, change the theme or update a plugin, clear the cache: there's usually a button in the WordPress top bar (Purge, Clear cache or Delete cache).
- If you also use Cloudflare with the proxy on, clear the cache there too (see Cloudflare in front of your website: when it helps and how to set it up).
If something doesn't work
- You see the old version of the page. Clear the plugin's cache, then force-reload the page in your browser (Ctrl+F5, or Cmd+Shift+R on a Mac). If it's still old, check whether the theme or Cloudflare also have a cache.
- The page has no styles or the menu no longer works. One of the options for combining or deferring scripts has broken the order of the files. Turn them off and clear the cache.
- A customer sees another customer's cart, or a form shows a security error. The cart page or the form page ended up in the cache. Exclude the page in the plugin settings and clear the cache right away.
- The website shows an error after you activate the plugin. Deactivate it from Enhance: the “Apps” tab, the WordPress page, “Plugins” » “Deactivate”. Some caching plugins leave rules in
.htaccessor files inwp-content; if the error persists, see Error 500 Internal Server Error and the blank page. - The plugin asks for Redis, Memcached or server settings. Contact us before you turn them on and we'll tell you what your plan supports.
