Title: Cache flushing on update
Last modified: July 13, 2021

---

# Cache flushing on update

 *  Resolved [Eroan Boyer](https://wordpress.org/support/users/eroan/)
 * (@eroan)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/cache-flushing-on-update/)
 * Hi,
 * Yoast includes a mecanism that flushes WP Super Cache and W3 Total Cache in _wpseo_activate().
 * It calls on line 207 of wp_seo_main.php :
    `WPSEO_Utils::clear_cache();`
 * Which does :
 *     ```
       public static function clear_cache() {
       		if ( function_exists( 'w3tc_pgcache_flush' ) ) {
       			w3tc_pgcache_flush();
       		}
       		elseif ( function_exists( 'wp_cache_clear_cache' ) ) {
       			wp_cache_clear_cache();
       		}
       	}
       ```
   
 * First question : why only those 2 and not WP Rocket and other popular cache plugins?
 * Second issue I’ve been having for years : at each update (which are sometimes
   several in a week), it flushes all the cache, which results in poor performance
   for websites with thousands of urls.
 * I’ve been downloading, removing content of clear_cache() then uploading but I
   must not be the only one in that case.
 * There is no purpose to flush all website cache just for an update.
 * Could you provide a hook to deactivate cache flush ? That would be sooooo useful.
 * Thanks and long life to Yoast.
    -  This topic was modified 4 years, 11 months ago by [Eroan Boyer](https://wordpress.org/support/users/eroan/).
    -  This topic was modified 4 years, 11 months ago by [Eroan Boyer](https://wordpress.org/support/users/eroan/).
    -  This topic was modified 4 years, 11 months ago by [Eroan Boyer](https://wordpress.org/support/users/eroan/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/cache-flushing-on-update/#post-14656462)
 * It’s old code and I agree that should be improved.
 * However, functions _\_wpseo\_activate_ and _\_wpseo\_deactivate_ are called only
   at the installation (or manual deactivation/activation of the plugin). WP update
   doesn’t run these functions (I didn’t notice similar behavior with WPSC). So,
   I think that it isn’t root of cause of your issue.
 * Updating some (Yoast) options could run _clear\_cache_ too… You should try to
   catch when purging was triggered. WPSC offers good debug log. Depends on cache
   plugin (W3TC or WPSC), you should try to find out debug back-trace when this 
   function called.
 * You [can create feature request on Github](https://github.com/Yoast/wordpress-seo/issues/new?assignees=&labels=&template=Feature_request.md).
 *  Thread Starter [Eroan Boyer](https://wordpress.org/support/users/eroan/)
 * (@eroan)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/cache-flushing-on-update/#post-14677370)
 * Hi,
 * thanks for your answer.
 * I don’t update any option, the only thing I do is update and it calls Yoast clear_cache()
   function since when I manually empty it there is no cache flushing.
 * I’ll try debug mode next time, thanks.
 *  Plugin Support [Michael Tiña](https://wordpress.org/support/users/mikes41720/)
 * (@mikes41720)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/cache-flushing-on-update/#post-14678511)
 * Hi,
 * There is an open feature request to provide the option to deactivate clearing
   of WordPress cache on plugin activation/deactivation, but as mentioned, this 
   shouldn’t occur when just updating the Yoast SEO plugin.
 * Please do try the debug mode as suggested. If you continue to encounter any issues
   or concerns, we recommend logging it on GitHub – [https://yoast.com/help/how-to-write-a-good-bug-report/](https://yoast.com/help/how-to-write-a-good-bug-report/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Cache flushing on update’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Michael Tiña](https://wordpress.org/support/users/mikes41720/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/cache-flushing-on-update/#post-14678511)
 * Status: resolved