Clear the page cache after an agent edit

MaintenanceBeginner~3 min

Before you start

Plugin version 1.13.0 or newer, and one of the 13 supported page cache plugins (WP Super Cache, WP Fastest Cache, W3 Total Cache, WP-Optimize, Cache Enabler, Hummingbird, Jetpack Boost, SpeedyCache, Breeze, SiteGround Speed Optimizer, LiteSpeed Cache, Nginx Helper or Proxy Cache Purge) serving cached pages. The site tools start off; enable Cache status and the post or URL purge on the Abilities tab. They need a user who can manage options. The purge tools are refused on a multisite network.

An agent updates a page, you open it, and the old text is still there. The edit worked. Your page cache is still handing out the copy it made before the change.

This prompt clears that one page and tells you, plugin by plugin, whether the old copy is really gone or the purge was only sent. You do not have to empty the whole cache for a single page.

The prompt
I just changed [the pricing page] and visitors still see the old version.
First read the cache status. Tell me which cache plugins are serving cached
pages, which purges each one supports, any cache in front of the site you can
see in the headers, and how much of the purge budget is left.
Then find the post I mean and check it is published. Purge just that post from
the page cache. If what I changed is not a post or page (an archive, say),
purge its URL on this site instead, with no query string.
Report each cache plugin's result and reason. If any says requested, explain
that removal could not be proven. If a CDN or host cache sits in front and no
cache plugin passes the purge on to it, tell me to clear that one myself.

Why this is safe to run

Cache status is a read: it calls no purge and sends no request. The post purge works out the page address from the post id, so the agent cannot aim it at an address you did not mean, and drafts, private posts and missing ids are refused before any cache plugin is called. The URL purge only takes an address on your own site, with no query string, fragment or wildcard. A plugin for which the home page means the whole site skips a home URL here, and the agent is pointed at the whole-site purge, which has its own cooldown.

Nothing here flushes the object cache or changes a cache plugin’s settings. Both purge tools are writes that start off, need a user who can manage options, and land in the Activity Log. If several pages changed at once, purge the whole page cache after a site-wide change covers that case.

Already connected? You do not have to paste this. Ask your agent for the “clear the page cache after an agent edit” recipe, or just tell it which page still looks stale.

How it works

  1. Read the cache status: which supported plugins are serving cached pages, what each can purge, and how much of the purge budget is left.
  2. Find the post you changed and confirm it is published.
  3. Purge that one post, or one URL on the site if it is not a post.
  4. Report each cache plugin's result: purged, requested, failed or skipped, with the reason.
  5. Name any cache in front of the site that this plugin does not purge itself.

Questions

Will this clear Cloudflare or my host's cache?
Not by itself. This plugin purges no CDN, Cloudflare, Varnish or host cache. A cache plugin you set up for one can pass the purge on: Proxy Cache Purge to its proxy, Nginx Helper to nginx, SiteGround Speed Optimizer to its server cache, and W3 Total Cache or WP Fastest Cache to Varnish, Cloudflare or a CDN configured inside them. WP Fastest Cache does not pass on a single URL purge. Cache status names the layers it can see in the request headers.
Why does the result say requested and not purged?
Purged needs proof that a cached copy existed and that none from before the call is left. LiteSpeed Cache, W3 Total Cache and Proxy Cache Purge never confirm a removal, so they never say purged; a successful call says requested. Requested also covers a page that was not in the cache to begin with.
Can the agent purge as often as it likes?
No. Every purge counts against one budget shared by all connections. By default that is 30 units in any 10 minutes, where a post or URL purge costs one unit. A call that is refused spends nothing, and the cache plugin's own screen is not limited.