Title: Purging cache on update
Last modified: June 4, 2026

---

# Purging cache on update

 *  Resolved [wildoperation](https://wordpress.org/support/users/wildoperation/)
 * (@wildoperation)
 * [4 days, 4 hours ago](https://wordpress.org/support/topic/purging-cache-on-update/)
 * Hello,
 * I was wondering if there is a way to trigger cache purging programmatically.
 * The issue we’re running into is that cache purges when a page is updated, but
   not when something like a general options page is updated. So I’d like to write
   our own hooks than then call the Cloudflare plugin’s cache purge — rather than
   recreating an API call, storing credentials separately, etc.
 * I searched through the plugin for something like save_post to see how you currently
   call the cache purge, but so far am coming up empty. Do you happen to have an
   example or can you point me in the right direction?
 * Thanks,
 * Tim

Viewing 1 replies (of 1 total)

 *  Thread Starter [wildoperation](https://wordpress.org/support/users/wildoperation/)
 * (@wildoperation)
 * [4 days, 3 hours ago](https://wordpress.org/support/topic/purging-cache-on-update/#post-18928643)
 * We found a solution for this. It seems like you can do this with both a hook-
   based approach or by calling the purge function directly. We didn’t test calling
   directly — only hooks — so I’ll share that here in case anyone else needs to 
   do something similar.
 * We found that adding these hooks to the theme functions didn’t work — they are
   registered too late. So we had to make a small plugin and add them there:
 *     ```wp-block-code
       /** * First add a custom action to the list of Cloudflare purge everything actions */add_filter(	'cloudflare_purge_everything_actions',	function ( $actions ) {		$actions[] = 'ddi_cloudflare_purge_everything';		return $actions;	});/** * Hook into the ACF options page save action, and call our custom action. * You can replace acf/options_page/save with any other action you're trying to intercept. */add_action(	'acf/options_page/save',	function ( $post_id, $menu_slug ) {		if ( $menu_slug === 'acf-options-alert-message' || $menu_slug === 'site-general-settings' ) {			do_action( 'ddi_cloudflare_purge_everything' );		}	},	10,	2);
       ```
   

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fpurging-cache-on-update%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/cloudflare/assets/icon-256x256.png?rev=2471183)
 * [Cloudflare](https://wordpress.org/plugins/cloudflare/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cloudflare/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cloudflare/)
 * [Active Topics](https://wordpress.org/support/plugin/cloudflare/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cloudflare/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cloudflare/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [wildoperation](https://wordpress.org/support/users/wildoperation/)
 * Last activity: [4 days, 3 hours ago](https://wordpress.org/support/topic/purging-cache-on-update/#post-18928643)
 * Status: resolved