Skip to content

Instantly share code, notes, and snippets.

@carlosonweb
Last active December 22, 2017 01:06
Show Gist options
  • Save carlosonweb/59d875f760ad6109aa6c191f334b5809 to your computer and use it in GitHub Desktop.
Save carlosonweb/59d875f760ad6109aa6c191f334b5809 to your computer and use it in GitHub Desktop.
Clear Cache After Theme or Plugin Update
add_action( 'upgrader_process_complete', function() {
//rocket cache
if ( function_exists( 'rocket_clean_domain' ) ) {
rocket_clean_domain();
}
// wp-super-cache
if ( function_exists( 'wp_cache_clear_cache' ) ) {
wp_cache_clear_cache();
}
// WPEngine
if ( class_exists( 'WpeCommon' ) ) {
WpeCommon::purge_memcached();
WpeCommon::clear_maxcdn_cache();
WpeCommon::purge_varnish_cache();
}
// w3 total crash
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
w3tc_pgcache_flush();
}
// siteground
if ( function_exists( 'sg_cachepress_purge_cache' ) ) {
sg_cachepress_purge_cache();
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment