diff --git a/ACTIONS.md b/ACTIONS.md index abb31e1d..54993417 100644 --- a/ACTIONS.md +++ b/ACTIONS.md @@ -168,12 +168,12 @@ Fires after `wp_body_open()` in the `` right before the inline storage ele --- ### `do_action( 'fictioneer_cache_purge_all' )` -Fires after all caches from known plugins have been purged in the `fictioneer_purge_all_caches()` function, normally triggered by a site-wide update. You can use this hook to purge additional caches. +Fires *before* all caches from known plugins have been purged in the `fictioneer_purge_all_caches()` function, normally triggered by a site-wide update. You can use this hook to purge additional caches. --- ### `do_action( 'fictioneer_cache_purge_post', $post_id )` -Fires after a post cache from known plugins has been purged in the `fictioneer_purge_post_cache( $post_id )` function, normally triggered by a specific post or page update. You can use this hook to purge additional caches. +Fires *before* a post cache from known plugins has been purged in the `fictioneer_purge_post_cache( $post_id )` function, normally triggered by a specific post or page update. You can use this hook to purge additional caches. **Parameter:** * $post_id (int) – The ID of the post/page to purge the cache for. diff --git a/includes/functions/_caching_and_transients.php b/includes/functions/_caching_and_transients.php index e3b9feea..a678d9f7 100644 --- a/includes/functions/_caching_and_transients.php +++ b/includes/functions/_caching_and_transients.php @@ -63,6 +63,9 @@ if ( ! function_exists( 'fictioneer_purge_all_caches' ) ) { // WordPress Query Cache wp_cache_flush(); + // Hook for additional purges + do_action( 'fictioneer_cache_purge_all' ); + // LiteSpeed Cache if ( class_exists( '\LiteSpeed\Purge' ) ) { do_action( 'litespeed_purge_all' ); @@ -83,9 +86,6 @@ if ( ! function_exists( 'fictioneer_purge_all_caches' ) ) { if ( function_exists( 'w3tc_flush_all' ) ) { w3tc_flush_all(); } - - // Hook for additional purges - do_action( 'fictioneer_cache_purge_all' ); } } @@ -108,6 +108,9 @@ if ( ! function_exists( 'fictioneer_purge_post_cache' ) ) { // Abort if... if ( empty( $post_id ) ) return; + // Hook for additional purges + do_action( 'fictioneer_cache_purge_post', $post_id ); + // WordPress Query Cache clean_post_cache( $post_id ); @@ -130,9 +133,6 @@ if ( ! function_exists( 'fictioneer_purge_post_cache' ) ) { if ( function_exists( 'w3tc_flush_post' ) ) { w3tc_flush_post( $post_id ); } - - // Hook for additional purges - do_action( 'fictioneer_cache_purge_post', $post_id ); } }