Skip to content

Disabling Automatic Clear or Wipe Cache Routines

gdarko edited this page Sep 6, 2020 · 2 revisions

If you're running a very large site with many cache files, you may want manual control over when the cache is cleared or wiped. You can disable the Clear and Wipe cache routines using an MU-Plugin.

An MU-Plugin is always active and does not require activation. As soon as a plugin file is created in the mu-plugins directory, the MU-Plugin is immediately active and the only way to disable it is to delete the plugin file from the mu-plugins directory.

Please create the wp-content/mu-plugins/ directory if it does not already exist and then add one of the following PHP files to that directory.

Note: These MU-Plugins only disable the automatic routines; the manual Clear Cache button, and the Wipe Cache button in MultiSite environments, still function from the WordPress Dashboard as expected. Also, auto-purge routines still function as expected; i.e., cache files for a Page/Post are still purged when the Page/Post is updated, along with any associated cache files (e.g., Home Page cache file, Posts Page cache file, Category/Tag/Author archive view cache files, etc.).

WARNING: Disabling these automatic routines is not recommended. The following MU-Plugins should only be used by advanced site owners who understand the implications of disabling these automatic routines and who are able to take manual intervention when the cache should be cleared or wiped.

Disabling 'Clear Cache' Routines

Inside wp-content/mu-plugins/ create this file: rc-disable-auto-clear-cache-routines.php:

<?php
/*
Plugin Name: Disable Rapid Cache Clear Routines
Description: Disables all automatic Rapid Cache Clear Routines
Author: Rapid Cache
Version: 1.0
Author URI: https://megaoptim.com/rapid-cache/
*/

add_filter('rapid_cache_disable_auto_clear_cache_routines', '__return_true', 10, 0);

Disabling 'Wipe Cache' Routines

Inside wp-content/mu-plugins/ create this file: rc-disable-auto-wipe-cache-routines.php:

<?php
/*
Plugin Name: Disable Rapid Cache Wipe Cache Routines
Description: Disables all automatic Rapid Cache Wipe Cache Routines
Author: Rapid Cache
Version: 1.0
Author URI: https://megaoptim.com/rapid-cache/
*/

add_filter('rapid_cache_disable_auto_wipe_cache_routines', '__return_true', 10, 0);

Disabling both the 'Clear Cache' and 'Wipe Cache' Routines

Inside wp-content/mu-plugins/ create this file: rc-disable-auto-clear-wipe-cache-routines.php:

<?php
/*
Plugin Name: Disable Rapid Cache Clear and Wipe Cache Routines
Description: Disables all automatic Rapid Cache Clear and Wipe Cache Routines
Author: Rapid Cache
Version: 1.0
Author URI: https://megaoptim.com/rapid-cache/
*/

add_filter('rapid_cache_disable_auto_wipe_cache_routines', '__return_true', 10, 0);
add_filter('rapid_cache_disable_auto_clear_cache_routines', '__return_true', 10, 0);

Disabling the 'Clear Cache' Routines on Plugin Activation/Deactivation

Inside wp-content/mu-plugins/ create this file: rc-disable-auto-clear-wipe-cache-routines.php:

<?php
/*
Plugin Name: Disable Rapid Cache Clear Routines on Plugin Activation/Deactivation
Description: Disables all automatic Rapid Cache Clear Routines on Plugin Activation/Deactivation
Author: Rapid Cache
Version: 1.0
Author URI: https://megaoptim.com/rapid-cache/
*/

add_filter('rapid_cache_auto_clear_on_plugin_activation_deactivation', '__return_false', 10, 0);

Clone this wiki locally