🎉 Free WordPress fix for our first 50 sites — in exchange for an honest review. Claim a spot →

Performance

WordPress Caching: Which Layer to Use and When

Jul 9, 2026 · 7 min read · By the Mend engineering team

WordPress has four distinct caching layers — page, object, browser, and CDN — and each one solves a different bottleneck. Use the right layer for the right job and your site gets dramatically faster; use the wrong one, or stack them carelessly, and you get stale content, broken checkout flows, and cache-poisoning bugs that are genuinely hard to diagnose. This guide explains exactly what each layer does, how to configure it correctly, and how to stack all four without side-effects.

Why WordPress Is Slow Without Caching

A WordPress page request, by default, is fully dynamic. PHP executes, WordPress queries the database, plugins run their hooks, the theme assembles HTML, and the whole thing gets sent to the browser — every single time, for every single visitor. On a modest shared host, that round-trip can take 800 ms to 2 s even before the browser renders anything.

Caching short-circuits that cycle by storing a pre-built version of the work so it can be reused. The question is which work to store, where to store it, and for how long — and the answer is different for each of the four layers.

Layer 1: Page Cache

What it does

A page cache intercepts incoming HTTP requests and serves a saved HTML file instead of executing PHP and hitting the database. It is the single biggest performance win for most WordPress sites — a cached page can be served in under 50 ms.

How it works

The first time a visitor requests /about/, WordPress builds the page normally and the cache plugin saves the resulting HTML to disk (or memory). Every subsequent request for /about/ gets that saved file. When you update the post, the cache is "busted" (invalidated) and rebuilt on the next request.

What to use

Popular options are WP Rocket (paid, easiest configuration), W3 Total Cache, and LiteSpeed Cache (if your host runs LiteSpeed). Many managed WordPress hosts — Kinsta, WP Engine, Cloudways — run a server-level page cache automatically, in which case you should not add a plugin-level page cache on top; the two will conflict.

What to exclude

Always exclude these URLs from page caching:

  • Cart, checkout, and account pages (/cart/, /checkout/, /my-account/)
  • Any URL that shows personalised content (search results, members-only pages)
  • The WordPress admin (/wp-admin/) — most cache plugins do this automatically
  • Pages with nonces or anti-CSRF tokens that expire

Serving a cached checkout page is one of the most common causes of broken WooCommerce flows. If you're seeing stale cart totals or payment errors, check your cache exclusions first.

Layer 2: Object Cache

What it does

WordPress has a built-in object cache API that stores the results of expensive database queries in memory so the same query isn't re-run within a single page load. By default this cache lives in PHP memory and evaporates at the end of the request. A persistent object cache — backed by Redis or Memcached — makes it survive across requests.

When it actually helps

Object caching pays off when:

  • Your site has a large database (thousands of posts, complex WooCommerce catalogs)
  • You are running a membership site or forum where page caching is largely disabled
  • You see high database CPU in your hosting dashboard
  • Multiple plugins repeatedly query the same data (menus, options, taxonomies)

On a simple five-page brochure site served from a managed host with page caching, adding Redis provides almost no measurable benefit — you'd be adding complexity for nothing.

How to enable it

Your host must support Redis or Memcached. Kinsta, WP Engine, Cloudways, and many others include Redis. Install the Redis Object Cache plugin (by Till Krüss), add your Redis connection details to wp-config.php if required by your host, and enable it in Settings → Redis. The plugin drops a object-cache.php drop-in into wp-content/ which WordPress loads automatically.

Layer 3: Browser Cache

What it does

Browser cache tells a visitor's browser to keep a local copy of static assets — images, CSS, JavaScript, fonts — for a set period. On a return visit the browser uses its local copy instead of re-downloading anything, which makes repeat-visit load times dramatically faster and reduces your server's bandwidth.

How to configure it

Browser cache is controlled by HTTP response headers — specifically Cache-Control and Expires. You can set them in three ways:

  1. Via your cache plugin. WP Rocket, LiteSpeed Cache, and W3 Total Cache all have a browser cache section. Enable it and accept the defaults as a starting point.
  2. Via your server config. In Apache, add rules to .htaccess; in Nginx, add expires directives to your server block. Your host's documentation will show the exact syntax.
  3. Via your CDN. If you're using a CDN (see below), you can set cache TTLs there and let the CDN headers override origin headers.

Recommended TTLs

Asset typeSuggested TTL
Images (JPEG, PNG, WebP)1 year
Fonts1 year
CSS / JS (versioned by WordPress)1 year
CSS / JS (no version query string)1 week
HTML pagesNo-cache or very short (handled by page cache instead)

WordPress automatically appends a version query string (e.g. ?ver=6.5.3) to its own CSS and JS files, which means a long TTL is safe — a plugin update changes the URL, bypassing the cached version automatically.

Layer 4: CDN Cache

What it does

A Content Delivery Network (CDN) copies your site's assets to servers in dozens of locations around the world. When a visitor in Tokyo requests your site hosted in New York, the CDN serves assets from a nearby node — cutting latency significantly. Some CDNs (Cloudflare being the most common) can also cache entire HTML pages at the edge, effectively combining CDN and page caching.

CDN options worth knowing

  • Cloudflare (free tier available): Reverse-proxy CDN that also provides DDoS protection and edge caching of HTML. The free plan is genuinely useful; the Pro plan adds more cache control.
  • BunnyCDN: Pull-CDN focused purely on asset delivery. Very affordable, excellent for static assets.
  • Cloudflare R2 / Amazon CloudFront: More complex, better for high-traffic or multi-region setups.

Cloudflare gotcha: always purge after updates

If Cloudflare is caching your HTML (it does this when you enable "Cache Everything" as a page rule), visitors can see an old version of your site for hours after you publish new content. Get into the habit of purging the Cloudflare cache after significant changes — or configure Cache-Control headers so Cloudflare respects shorter TTLs on HTML while still caching assets aggressively.

How to Stack All Four Layers Safely

Here is a sensible default configuration for most WordPress sites:

  1. Page cache — handled by your host's server-level cache (preferred) or a plugin like WP Rocket. Exclude cart, checkout, and account pages.
  2. Object cache — add Redis only if your host supports it and your site is database-heavy. Skip it on simple sites.
  3. Browser cache — configure long TTLs for static assets via your cache plugin or server config. Let WordPress's versioning handle cache-busting for its own assets.
  4. CDN — put Cloudflare (free) or BunnyCDN in front for asset delivery. Keep HTML caching at the CDN off unless you have a specific reason and a reliable purge workflow.

The most common stacking mistake is running two page caches simultaneously — a plugin-level cache and a host-level cache — which causes double-caching bugs and unpredictable invalidation. If your host caches pages, disable the page-caching module in your plugin and use the plugin only for minification, browser cache headers, and CDN integration.

Diagnosing Cache Problems

If you suspect your cache is serving stale content or causing errors, here is a quick triage sequence:

  1. Open the affected page in a private/incognito browser window (bypasses browser cache).
  2. Add ?nocache=1 or a unique query string to the URL — most page caches skip URLs with query strings.
  3. Log in to your host control panel and purge the server-level cache, then reload.
  4. If you're using Cloudflare, purge everything from the Cloudflare dashboard.
  5. Enable WordPress debug logging and check for PHP errors being masked by a cached error page — see how to read the WordPress debug log if that's unfamiliar territory.

If the problem disappears with query strings or after a full purge, the issue is definitely a stale cache. If it persists, the problem lives deeper in WordPress itself.

When to Call a Professional

Caching configuration is one of those tasks that looks straightforward until something breaks — a plugin update invalidates the wrong cache layer, Redis gets misconfigured and serves stale data to logged-in users, or a CDN rule accidentally caches a checkout page and every customer sees the same order total. If you're spending more time debugging your caching setup than running your site, that's a fair signal to get expert help.

Mend's Speed Pass is a flat-fee performance fix that includes auditing and correctly configuring all four caching layers for your specific hosting environment — most sites are done the same day, with a plain-English report of exactly what changed and why. If your site is actively broken right now, a free Diagnosis will triage the problem and quote a flat price before any work starts.


Preventing Cache Problems Before They Start

A few habits that save hours of debugging:

  • Always purge caches after a WordPress, theme, or plugin update. Most cache plugins have a "purge all" button in the admin toolbar — use it.
  • Test on a staging site before deploying cache configuration changes to production. A misconfigured exclusion rule on staging breaks nothing; the same rule on production breaks your checkout.
  • Document your cache stack. Write down which layers are active, where they're configured (plugin vs. server vs. CDN), and how to purge each one. This becomes invaluable when something breaks at 11 pm.
  • Monitor with an uptime tool. A silent caching failure can make your site appear to work while serving outdated or broken content to every visitor except you, because you're logged in and bypassing the cache.

Frequently asked questions

Does caching break the WordPress admin?

No — page caching is automatically bypassed for logged-in users and the /wp-admin/ area in all reputable cache plugins. If your admin feels stale, try a hard reload (Ctrl+Shift+R / Cmd+Shift+R) to clear your browser's local cache.

Why does my WooCommerce cart keep showing wrong items or totals?

Almost always a page cache issue — the cart, checkout, or session cookie isn't being respected as a cache-bypass signal. Check your cache plugin's WooCommerce exclusion settings and make sure /cart/, /checkout/, and /my-account/ are excluded from caching.

Should I use a cache plugin if my host already caches pages?

Keep the plugin but disable its page-caching module. Most hosts cache at the server or Nginx level, which is faster than plugin-level caching. You can still use the plugin for browser cache headers, minification, lazy loading, and CDN integration — just not for page caching.

How often should I purge my CDN cache?

You don't need a schedule — purge manually after publishing major content changes or deploying a site update. For routine blog posts, your CDN's normal TTL will expire the cached version quickly enough. The key is purging immediately if a critical change (a corrected error, a security fix) needs to reach visitors right away.