Quantcast
Channel: WordPress Ideas » Tag: compatibility - Recent Posts
Viewing all articles
Browse latest Browse all 94

Jose on "standard wordpress action hook to clear cache for cache plugins"

$
0
0

As many users know, server cache could be very nice, but sometimes a little annoying. I think it would be great to have a standard WordPress action hook and function to clear the cache. So all plugins developers could use this function and have high probability that whatever server cache plugin is active, the cache will be cleared. WordPress should pretend that cache plugins authors hook to the standard action in their plugin.

Let's suppose we call this action "wp_clear_cache_by_all_server_cache_plugins".

E.g. let's consider WP_SUPER_CACHE. It clears the cache with wp_cache_clear_cache(). In this case in WP Super Cache plugin we should have:

add_action( 'wp_clear_cache_by_all_server_cache_plugins','wp_cache_clear_cache'
function wp_cache_clear_cache(){
   ....
   //code of the plugin
  ....
}

//Or W3 Total Cache
add_action( 'wp_clear_cache_by_all_server_cache_plugins','w3tc_pgcache_flush' );
function w3tc_pgcache_flush(){
   ....
   //code of the plugin
  ....
}

Doing so, on a third plugin, you can define a function to clear the cache and if the active cache plugin has respected the standard action, the cache will be cleared:

function clear_cache_by_third_plugin(){
   do_action( 'wp_clear_cache_by_all_server_cache_plugins' );
}

Imagine when the third plugin has to update something and wants to clear the cache, in this way this problem would be solved. The cache plugins are a lot, but they are not infinite. I think it would be also the interest of cache plugins authors to have a standard cache plugin.


Viewing all articles
Browse latest Browse all 94

Trending Articles