2

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?

4
  • If you don't want the plugin on the dev site, just don't install it. Why do you need to install in and then programmatically disable it?
    – s_ha_dum
    Sep 20, 2013 at 5:02
  • because it's under version control Sep 20, 2013 at 14:49
  • Hmmm... yeah, that makes it hard in this case.
    – s_ha_dum
    Sep 20, 2013 at 15:04
  • Disagreed that this is off topic; W3TC is a wordpress plugin and the steps to disable it are specific to WP and that plugin, not PHP in general.
    – El Yobo
    Jun 19, 2015 at 2:09

1 Answer 1

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.

3
  • I totally get and agree with you. Do you have any advice on where to start to explicitly disable in my dev env.? Sep 20, 2013 at 14:50
  • 1
    @JaredEitnier that depends on how exactly you are setting up mirroring/migration... There is always going into admin and disabling it in plugin list. :)
    – Rarst
    Sep 20, 2013 at 15:03
  • well i'm using git, all my plugins are installed in the dev site and then I just do a git pull on production. So normally we would handle this by checking environmental variables (if site == production do something...). I need to do this on the fly. Sep 20, 2013 at 15:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.