If you use Cloudways, the Breeze caching plugin, and Cloudflare Enterprise Edge Cache, you've likely run into this frustrating issue: When you update a Post or Custom Post Type (CPT), the parent listing pages, custom taxonomy archives, and Page Builder pages (like a Knowledge Base containing a post grid) do not update. By default, Breeze aggressively clears the cache for the single post ID you just edited, but it fails to recognize the complex relationships of modern WordPress sites built with custom post types or page builders.
This snippet bridges the gap between Breeze and your site's architecture. It acts as a "Traffic Controller" for the Cloudflare/Varnish cache, doing two main things:
- Auto-Detection: It programmatically hooks into WordPress to find the CPT Archive and any assigned Custom Taxonomy pages (e.g., Event Categories) and adds them to the purge queue.
- Relationship Mapping: It includes a simple
$custom_page_maparray where you can explicitly tell Breeze, "When an 'Event' is updated, also clear the '/knowledge-base/' page."
This snippet is made possible by two specific filters recently introduced in the Breeze plugin changelog:
breeze_cf_purge_type_on_post_update: By default, Breeze queues Cloudflare purges asynchronously via a WP-Cron job. This causes a confusing delay where the cache looks unbroken, but it's actually just waiting. This snippet forces the return value to'synchronous', executing the purge immediately upon hitting "Update."breeze_purge_post_cache_urls: This filter allows developers to inject an array of custom URLs into the Breeze purge queue.- Critical Nuance: As per the Breeze core code, Cloudflare strictly requires a trailing slash for these URLs. This snippet utilizes
trailingslashit()on every generated URL to ensure the API call succeeds.
- Critical Nuance: As per the Breeze core code, Cloudflare strictly requires a trailing slash for these URLs. This snippet utilizes
Prerequisites & Troubleshooting if using the Cloudways Cloudflare Enterprise integration (via native cloudways add-on)
For this snippet to successfully clear the Cloudflare Edge Cache, your Cloudways application must have its Cloudflare credentials loaded. This should be set when "smart purge" is turned on in the cloudflare settings tab.
Check your wp-config.php file. If the following constants are missing, Breeze will silently abort the Cloudflare purge: The solution is to re-configure "smart purge" on the cloudflare settings tab.
define( 'CDN_SITE_ID', '...' );
define( 'CDN_SITE_TOKEN', '...' );