Purge additional URLs with APO

Before I switched from manual cache rules to APO, I had a cloudflare_purge_by_url function that would purge additional URLs I also need purged every time we publish or edit posts in WordPress.

That doesn’t seem to work anymore with APO, but I still need that. How can I tell APO to purge some additional URLs, please?


Thank you for reaching out to us. You can clear those extra URLs by using Cloudflare’s API. Here are a few ways to do it:

  1. Using Cloudflare API

You can send a request to Cloudflare’s API to clear the cache for specific URLs.

  • Get Your Details: Find your Cloudflare Zone ID, email, and API key.
  • Make a Request: Use a tool like curl to send a request. Here’s an example:
curl -X POST "https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/purge_cache" \
     -H "X-Auth-Email: YOUR_EMAIL" \
     -H "X-Auth-Key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     --data '{"files":["https://example.com/url1", "https://example.com/url2"]}'
  1. After some investigation, I’ve found that some plugins can help you manage Cloudflare cache. One such plugin is the WP Cloudflare Super Page Cache. This plugin can help you specify additional URLs to purge when you update content.

For more information please refer to the following:

Please let us know if you have further questions

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.