Skip to content

Cloudflare cache not clearing on WordPress: find which layer is actually stale

You purged Cloudflare and the old page is still there. On WordPress there are at least four caches between the editor and the visitor, and the purge button only clears one of them. Here is how to identify the stale layer and clear them in the right order.

When a WordPress edit does not show up on the live site, “clear the Cloudflare cache” is the reflex — and it usually clears the one layer that was not the problem. Between the editor and the visitor sit the browser cache, Cloudflare’s edge cache, a page-cache plugin (LiteSpeed Cache, WP Rocket, W3 Total Cache), and often a Redis object cache plus PHP OPcache. A purge only helps if it hits the layer holding the stale copy. Read the response headers, identify the layer, purge from the origin outward.

What’s happening

The layers stack in a fixed order: browser cache → Cloudflare edge → server/plugin page cache → object cache and OPcache → the database. Each one can hold an old copy independently, and clearing a layer downstream of the stale one changes nothing.

The detail most people miss: by default Cloudflare does not cache HTML at all — only static extensions like CSS, JS, images, and fonts. Unless you run APO or wrote a Cache Rule that caches HTML, a stale page is almost never Cloudflare’s fault; it is the page-cache plugin or a server cache. A stale stylesheet or image, on the other hand, is usually Cloudflare or the browser. Matching the symptom to the layer before purging anything saves the whole guessing game.

What to check first

  • What kind of content is stale. HTML page → suspect the plugin/server cache first. CSS/JS/images → suspect edge and browser.
  • Whether Cloudflare even caches your HTML. One header read answers it (below). cf-cache-status: DYNAMIC on the page means Cloudflare is not storing it, and purging the zone will never fix that page.
  • Which caching plugins are active. Two page caches at once (a plugin plus LiteSpeed at the server level) is common and doubles the purge surface.
  • Whether you are logged in while testing. Most page caches serve logged-in users fresh content, so the site looks fixed to you and stale to everyone else.

How to verify

Read the headers on the stale URL:

curl -sI https://example.com/pricing/ | grep -iE '^(cf-cache-status|age|cache-control|x-litespeed-cache|x-cache)'

Interpret: cf-cache-status: HIT with a large age means the edge holds the copy — purge Cloudflare. DYNAMIC or BYPASS with stale content means the staleness is behind Cloudflare — look at x-litespeed-cache: hit or x-cache headers from the origin stack. Then force a fresh path through every cache with a cache-busting query:

curl -s "https://example.com/pricing/?nocache=$(date +%s)" | grep -o 'the string you edited'

If the cache-busted response is still old, no HTTP cache is guilty — think OPcache holding old PHP, an object cache holding old options, or the edit never publishing. Finally, compare the edge against the origin directly:

curl -sI https://example.com/pricing/ --resolve example.com:443:203.0.113.10 | grep -iE '^(x-litespeed-cache|age|cache-control)'

Fresh at the origin but stale through Cloudflare: edge problem. Stale at the origin too: stop purging Cloudflare.

The fix

  1. Purge from the origin outward. Innermost first: OPcache if PHP files changed (cachetool or a service reload), object cache if options/menus are stale (wp cache flush), then the page-cache plugin, then Cloudflare, then a hard browser reload. Purging in the other order lets the edge re-cache a still-stale origin copy immediately.
  2. Purge the right Cloudflare thing. Single-file purge must match the exact URL in the cache key — scheme, host, and query string included. When in doubt on a small site, Purge Everything: propagation takes seconds and the origin refill on a WordPress site is modest.
  3. Wire the plugin to Cloudflare. LiteSpeed Cache, WP Rocket, W3TC, and the official Cloudflare plugin can call the purge API on post update, so edits clear both layers automatically. Configure it once with an API token scoped to Zone.Cache Purge.
  4. If you run APO, the Cloudflare plugin purges APO’s HTML copies on publish — confirm the plugin is connected and the token is valid; a silently expired token is the classic “APO never updates” cause.
  5. Rule out the browser last. If curl shows fresh content while a browser shows stale, it is the visitor-side cache — that is a Browser Cache TTL discussion, not a purge problem.

When this fix is wrong

If cf-cache-status never reads HIT on the stale URL, Cloudflare purges are theatre — the copy lives at the origin. If content is stale only in one browser or on one phone, it is browser cache or a service worker, and no server-side purge reaches it. And if the cache-busted request is stale too, you have an application problem (old PHP in OPcache, a stale transient, or the change was never published), not a cache-clearing problem.

Common mistakes

  • Purging Cloudflare for a stale HTML page that Cloudflare never cached (DYNAMIC).
  • Testing while logged in to wp-admin, where page caches are bypassed and everything looks fixed.
  • Trusting the plugin’s “cache cleared” notice while a second cache layer (server-level LiteSpeed, Varnish, a host’s built-in cache) keeps serving.
  • Forgetting a PWA service worker that pins old assets no matter what you purge.
  • Clearing everything hourly “to be safe” and paying for it in origin load and slow TTFB.

Prevention

Keep one page cache, not two — pick the plugin or the server layer and disable the other, as laid out in the WordPress cache-stack comparison. Automate purges on publish through the plugin’s Cloudflare integration, and adopt the purge patterns from Cloudflare purge strategies instead of Purge Everything as a habit. Document which layers exist on each site; the official cache docs cover what Cloudflare stores by default.

Once every layer purges itself at publish time, “the client still sees the old page” disappears from the ticket queue. Cache layers that fight each other cost real revenue — Stack Harbor tunes the whole stack, edge to origin, under Managed Cloud Ops; book an infrastructure review.