Clearing your WordPress cache doesn’t always remove cached content from Cloudflare. If Cloudflare still holds an older version of a page, visitors may continue to see outdated content even after you’ve cleared the WordPress cache.

By connecting RunCache to Cloudflare, you can clear both caches directly from your WordPress dashboard, helping ensure visitors see the latest version of your site.

Before you start

Before you start, make sure you have:

  • Administrator access to WordPress.
  • Access to the Cloudflare account that manages your domain.
  • Permission to create an API token for the relevant Cloudflare zone.

Connect Cloudflare to RunCache

To purge Cloudflare cache from WordPress, first connect RunCache to your Cloudflare account:

  1. Log in to Cloudflare and open your profile menu.
  2. Go to Profile > API Tokens.
Cloudflare API token
  1. Click Create Token and select the WordPress template.
  2. Cloudflare pre-populates most of the token settings. You can keep the default permissions, but restrict the token to the domain you want RunCache to manage. Scroll to Zone Resources.
  3. Under Zone Resources, select Include > Specific zone, then choose your domain.
API keys zone in Cloudflare.
  1. Click Continue to Summary and review the token settings.
  2. Click Create Token. Cloudflare displays the token only once, so keep this tab open until you have copied the token into RunCache.
  3. Open WordPress in another browser tab or window, then go to RunCache > Dashboard > CDN Edge Cache.
  4. Rewrite the APO setup steps
Cloudflare APO
  1. Enable Cloudflare APO.
  2. Paste the Cloudflare API token you created into the API token field.
  3. Click Save. After RunCache verifies the connection, the CDN Edge Cache section should display “Enabled and Working”.
APO enabled

This example uses Cloudflare APO. If you use Cloudflare Page Cache instead, select that provider in the CDN Edge Cache section and follow its configuration fields.

Purge the Cloudflare Cache from WordPress

After you connect a Cloudflare CDN Edge Cache provider, RunCache can send purge requests to Cloudflare when you clear cached content in WordPress.

  • To clear the full cache, click Purge All in the WordPress admin bar or Purge cache in RunCache. RunCache also sends a full-zone purge request to Cloudflare.
Purge cache
  • To purge the current page, click Purge this page. RunCache sends the related URLs to Cloudflare for purging.
Purge this page

If Cloudflare rejects a purge request, RunCache records the error in its logs rather than displaying an error in the WordPress admin area.

If content remains cached after a purge, check the RunCache logs for token, permission, or Cloudflare API errors.

Verify That the Cloudflare Cache Was Cleared

Cloudflare can return a cf-cache-status response header that indicates how it handled the request.

You can check the header with:

curl -s -o /dev/null -D - https://example.com/ | grep -i cf-cache-status

For example:

cf-cache-status: dynamic

The cf-cache-status value can help you understand whether Cloudflare served a cached response:

  • HIT means Cloudflare served the response from its cache.
  • MISS means Cloudflare did not have a cached copy and requested the content from the origin server.
  • DYNAMIC means Cloudflare did not cache that response.

See Cloudflare’s documentation for the full list of possible values.

CF purge

If the cf-cache-status header is missing, check that the domain is proxied through Cloudflare.

After purging a cached page, check the next request again. You should normally see Cloudflare fetch a fresh response rather than immediately serving the previous cached copy.

If the page continues to return HIT unexpectedly, check the RunCache logs and confirm that the API token has permission to purge the selected zone.

Once Cloudflare has fetched the updated page, later requests may return HIT again as the edge cache is repopulated.