xSpeed Cache is officially live! Get 50% OFF during Launch Week — Lifetime starts at just $79Lifetime from $79 — 50% OFF, Launch Week! See Plans →

See Plans →
Features
xSpeed Hub Pricing Docs Blog Scan
Appearance
Get Plugin

Purge the WordPress cache with Claude Code

Purging the WordPress cache with Claude Code means asking it, in the terminal you deploy from, to clear the xSpeed cache on the site you just changed and warm it again through xSpeed Hub.

list_sitesget_cache_statuspurge_cachepurge_cloudflarestart_preloader

Last updated: October 2026

Example session · Claude Code

You: Pushed the new stylesheet to shop. Use xSpeed Hub to clear whatever is stale.

list_sites read-only
→ 6 sites; shop is shop.example.com

Claude Code: Only CSS changed, so an assets purge is enough and the cached HTML can stay. Purge assets on shop?

You: Yes.

purge_cache(site: shop, type: assets) changes site
→ 48 minified CSS and JS files cleared

Claude Code: Done, the assets cache on shop is empty and rebuilds on the next request. If a page still loads the old styles, its cached HTML points at the old files; say so and I will purge pages too.

01

How Claude Code handles this

The usual moment is right after a deploy. You pushed a theme change or a plugin update from the same terminal, and the live site still serves the old CSS because the cached pages point at it. Instead of opening wp-admin, you tell Claude Code which site and what changed. It calls list_sites to match the name, picks a purge type that fits the change, and runs purge_cache through the xspeedhub server you added with claude mcp add.

What comes back is the plugin's own report: which stores were cleared, how many entries, and whether a connected Cloudflare zone accepted the purge. A purge of type all covers the page cache, the object cache and, when they are connected, the Cloudflare edge and CDN, so Claude Code can tell you in one line whether anything refused. For a CSS-only change it can purge assets instead, which leaves the stored HTML alone.

Claude Code shows each tool call before it runs it unless a permission rule allows that tool, or you run it in auto mode (a classifier reviews actions instead of you) or bypassPermissions mode (no prompts), so a purge appears as mcp__xspeedhub__purge_cache with its arguments, and you approve it or not. For a purge across every site, the Hub also tells Claude Code to say "this will touch all N sites" and wait for your go-ahead before it sends the single site: "all" call.

02

Set up Claude Code once

Already connected? Skip to the prompts. Alternatives and troubleshooting are on the Claude Code guide.

1Put your sites in xSpeed Hub

Sign in at app.xspeedcache.com with Google or email; the Hub is free and has no site cap. Then connect each WordPress site from its own dashboard: click Connect Hub in the xSpeed Cache top bar, then Connect via xSpeed Hub. Each site needs the free xSpeed Cache plugin.

2Add xSpeed Hub to Claude Code

Run this once. --scope user makes the server available in every project; leave it off and it applies to the current project only, which is Claude Code's default.

Terminal
claude mcp add --transport http --scope user xspeedhub https://app.xspeedcache.com/xspeed/mcp

3Sign in with /mcp

Start Claude Code, run /mcp, pick xspeedhub and finish the sign-in in your browser. You approve access on an xSpeed Hub page; there is no token to paste, and Claude Code keeps the credentials it receives and refreshes them.

Text
/mcp
1 / 3

Full Claude Code setup, sign-in options and FAQ

Before you send a prompt that changes something

Reads change nothing on your sites, though contact_support emails xSpeed support. Writes run once your connection allows them, so your client's approval prompt and a read-only connection (the token's Read-only everywhere switch, or a Viewer sign-in) are the gates that matter. Claude Code asks before it runs an MCP tool unless a permission rule already allows it, or you work in auto mode, where a classifier reviews actions instead of you, or in bypassPermissions mode, which skips prompts. A rule such as mcp__xspeedhub__get_cache_status allows one tool, and mcp__xspeedhub__get_* allows every read whose name starts with get_. Keep purge_cache, update_settings, toggle_cache and the other write tools on the prompt, because the Hub itself runs a write as soon as your connection allows it.

03

What do I ask?

Three prompts written for Claude Code. More for this job are below.

Prompt for Claude Code
I just deployed the new header to shop. Use xSpeed Hub to purge only the assets cache there and tell me what was cleared.
Prompt for Claude Code
With xSpeed Hub, purge every site in my workspace, then list any site where the purge failed and why.
Prompt for Claude Code
Use xSpeed Hub to purge the blog site fully, start the preloader, and check the hit ratio again in ten minutes.
04

What happens, step by step

A purge throws away stored copies so the next visitor gets a fresh page. Through xSpeed Hub an agent can purge everything, only pages, only CSS and JavaScript assets, the object cache or the REST cache, on one site or across every site in a workspace. A full purge also clears the Cloudflare edge when the site has Cloudflare connected.

01

Find the site

The agent calls list_sites when you have more than one site, then matches the name you used to a site handle. If the name could mean two sites, the Hub tells it to ask you rather than guess.

02

Pick the purge type

purge_cache takes a type: all, page, assets, object or rest. all clears the page cache, the object cache and, when they are connected, the Cloudflare edge and CDN. After a theme or CSS change, assets is enough; after a content edit, page; after a deploy, all.

03

Purge

The call runs straight away on that site once your connection allows writes. For every site at once the agent passes site: "all", and the Hub runs the sites one after another with a one-second pause.

04

Clear only the edge if that is all you need

purge_cloudflare empties the Cloudflare edge cache on its own, without touching the copies on your server. A page or assets purge does not reach Cloudflare; a purge of type all does when Cloudflare is connected.

05

Warm it again

start_preloader rebuilds the cache in the background so the first visitors after the purge are not the ones paying for it.

05

Reference

Toolpurge_cache (write)
Purge typesall, page, assets, object, rest
What all coversPage cache, object cache, plus the Cloudflare edge and CDN when connected
Every site at oncesite: "all" or a list of handles, one result per site
Fan-out pacingSites run one after another with a 1 second pause
Edge onlypurge_cloudflare, a separate write tool
Re-warmstart_preloader after the purge
Read-only accesspurge_cache is refused on a connection token with Read-only everywhere on, and for a Viewer sign-in
ConfirmationNone on the Hub; your client's prompt is the gate
06

Rules worth keeping

  • Name the site. With several sites, an unclear name should make the agent ask, and the Hub tells it to.
  • A purge of every site is one call with site: "all". The Hub tells the agent to confirm it with you once before it runs.
  • Purge the narrowest type that fixes the problem, then warm the cache, so visitors do not all hit uncached pages at once.
  • A fan-out result is reported per site. Treat some sites failing as a partial result, not a failure of the whole call.

Good to know with Claude Code

If you added xspeedhub without --scope user, it only exists in the project where you ran claude mcp add, so in another repository Claude Code will say it has no xSpeed tools. Run the add command again with --scope user, or add it to that project, and sign in again with /mcp, or run claude mcp login xspeedhub from the shell, if Claude Code asks. And if you have allowed mcp__xspeedhub__* in your permissions, purges no longer prompt; scope the allow rule to the get_ tools if you want to keep seeing writes. Auto mode and bypassPermissions mode skip the prompt as well.

07

More prompts for this job

They work in any client connected to xSpeed Hub.

Prompt
Use xSpeed Hub to purge the page cache on blog.
Prompt
I just changed the theme CSS on shop. Use xSpeed Hub to purge only the assets cache there.
Prompt
With xSpeed Hub, purge every site in my workspace and tell me which ones failed.
Prompt
Use xSpeed Hub to purge shop, then purge its Cloudflare edge cache too.
Prompt
With xSpeed Hub, purge the docs site and start the preloader so it is warm again.
Prompt
Using xSpeed Hub, what purge type should I use after updating a plugin that changes the checkout page?
08

Frequently asked questions

Yes. With xSpeed Hub added as an MCP server, ask it in the same session to purge the site you deployed. It calls purge_cache with the type that fits the change and reports what was cleared.

Claude Code prompts for each MCP tool call unless a permission rule allows that tool, or you are in auto mode (a classifier reviews actions instead of you) or bypassPermissions mode (no prompts). The Hub itself runs the purge as soon as your connection allows writes, so the Claude Code prompt is the check unless you allowed purge_cache or use one of those modes.

all clears every cache xSpeed manages for the site, including a connected Cloudflare zone or CDN. page clears the stored HTML pages, assets clears minified and combined CSS and JavaScript, object clears the Redis or Memcached object cache, and rest clears cached REST API responses.

A purge of type all does, when the site has Cloudflare connected in xSpeed: it clears the page cache, the object cache and the Cloudflare edge, and reports each one. A page, assets or rest purge stays on your server. purge_cloudflare clears only the edge.

Yes. The agent passes site: "all" to purge_cache and the Hub purges every site in the workspace one after another, returning a result per site. The Hub tells the agent to confirm a write across every site with you once before it runs it.

The next request to each purged page builds it fresh, which is slower than a cached hit. Starting the preloader right after the purge rebuilds the cache in the background so visitors mostly land on warm pages.

09

Keep going

Purge the cache with other agents

More with Claude Code

Documentation

From the blog

Purge the cache, from Claude Code.

xSpeed Hub is free and has no site cap. Connect your sites once and ask from the agent you already use.