How to Clear the WordPress Cache (Every Layer)
A WordPress page passes through up to five caches. Purge them in the right order — object, page, host, CDN, browser — or you will keep seeing the old version and blame the wrong one.
Quick answer: purge from the inside out. Object cache first, then the page cache plugin, then the host's server cache, then the CDN, then your own browser. Purging in the wrong order refills a downstream cache with content the upstream one has not refreshed yet.
Know which layers you have
| Layer | Where it lives | How to purge |
|---|---|---|
| Object cache | Redis/Memcached on the server | wp cache flush, or the host panel |
| Page cache plugin | wp-content/cache/ |
The plugin's purge button |
| Server cache | Nginx FastCGI, Varnish, LiteSpeed | Hosting control panel |
| CDN | Cloudflare or similar | The CDN dashboard |
| Browser | The visitor's machine | Hard reload, or a new version string |
Most sites have two or three of these. Sites that feel impossible to update usually have four.
Purge the page cache plugin
Every caching plugin puts a purge control in the admin bar or under its own settings screen — "Purge All Caches", "Delete Cached Pages" or similar. Use that first, and purge everything rather than a single URL when you are debugging.
Without admin access, delete the contents of wp-content/cache/ over SFTP. Delete what is inside the directory, not the directory itself.
Two files also matter:
wp-content/advanced-cache.php— the page-cache drop-in;wp-content/object-cache.php— the object-cache drop-in.
If you removed a caching plugin and stale pages persist, one of these was left behind. Deleting an orphaned drop-in is safe when the plugin that created it is gone.
Purge the server cache
Managed hosts run their own cache in front of PHP, and the plugin's purge button does not always reach it. Look for a "Clear cache" or "Purge cache" control in the hosting panel.
Confirm whether a response came from cache by reading the headers — see how to check HTTP headers. A header such as x-cache: HIT or x-litespeed-cache: hit tells you which layer answered.
Purge the CDN
In Cloudflare, use Caching → Configuration → Purge Everything while debugging, and purge by URL for routine updates. Development Mode temporarily bypasses the cache entirely, which is useful while working on a page and forgettable afterwards — it expires on its own after a few hours.
Remember that a CDN caches HTML only if you configured it to. If your CSS updates but the page does not, HTML is being cached somewhere else.
Purge the object cache
An object cache stores database query results. Stale entries show up as settings that will not change and menus that will not update:
wp cache flush
Without WP-CLI, restart Redis or Memcached from the hosting panel, or use the object-cache plugin's own flush control.
Clear the browser cache
Your browser is the last layer and the easiest to mistake for a site problem.
- Hard reload:
Cmd+Shift+Ron macOS,Ctrl+F5on Windows. - Better: open DevTools, tick Disable cache in the Network tab, and keep DevTools open while you work.
- Best for confirming a fix: a private window, which starts with nothing cached.
For visitors, browser caching of assets is controlled by version strings. WordPress appends ?ver= to enqueued files, so a theme or plugin update refreshes them automatically. If you edited a stylesheet directly, bump its version:
<?php
wp_enqueue_style('child-style', get_stylesheet_uri(), [], '1.4.2');
Purge from the command line
wp cache flush # Object cache
wp transient delete --expired # Expired transients
wp rewrite flush # Rewrite rules, not a cache but often needed alongside
Caching plugins add their own commands — check wp help for the plugin's namespace before assuming a generic command covers it.
Still seeing the old version?
Work through this before touching settings:
- Test in a private window on mobile data. If it looks correct there, the remaining problem is your own browser or network.
- Add a dummy query string, such as
?v=2, to bypass most caches. If the page is correct with it, something is caching the plain URL. - Check whether the site is behind a proxy or optimisation service you forgot about.
- Confirm you are editing the site you are viewing — staging and production mix-ups are surprisingly common.
The full diagnostic path is in WordPress changes not showing.
Sensible defaults
- Run one page-cache layer, not two.
- Exclude cart, checkout, account and any personalised page from full-page caching.
- Let the cache do its job between deployments; purging everything on a schedule wastes the benefit.
- Purge automatically on publish — most plugins do this, and it is worth confirming.
- If caching keeps breaking things, the fix is usually excluding one script or page, not switching plugins. Plugin choices are compared in the best WordPress cache plugins.
Frequently asked
- From the server outwards: object cache, then the page cache plugin, then the host cache, then the CDN, then your browser. Purging the CDN first just refills it from a stale origin.
- Yes. Delete the cache directory contents over SFTP, purge from the hosting panel, or use WP-CLI. The right method depends on which layer created the cached copy.
- That is normal — the next visitor regenerates it. A problem only exists if the regenerated copy is still wrong, which points at the origin rather than the cache.