Programmatically disable W3 Total Cache in development environment

I’ve got two environments in my project: dev & production. I just want to be able to deactivate or disable W3TC in my dev environment but the plugin has no native support for this . I also can’t find a deactivate hook that works with the plugin and setting define('WP_CACHE', false); based on HTTP_HOST seems to be bypassed in wp-config.php.

So surely this has come up before for people – what is the solution?

Related posts

1 comment

  1. Caching plugins are very challenging to disable because on top of normal plugin functionality they tend to:

    • created extra drop-in files
    • set caching constants
    • bypass PHP completely with .htaccess

    While it’s not impossible to mangle specific plugin into submission, it’s flaky. More reliable to explicitly disable it in dev and keep. Note that implicitly stopping plugin from loading might not even be enough thanks to leftover extras that are cleaned up only via proper deactivation routine.

Comments are closed.