Ever wanted to have some plugins active on your Staging site but automatically deactivated on your Live or Production site? Yeaaaa! Meeee! Tooo! This makes it easy to do that. I kept having an issue where the Query Monitor plugin was conflicting with another plugin… but ONLY on the Production WordPress site. Very weird. Very frustrating. Until I used this to automatically deactivate the specific plugins I listed… it saved me from having to login to the site after every time we pushed our Staging site to Production! This script assumes that every site is Production unless the site’s domain contains one of the `$stagingKeywords` (which you can customize) and automatically deactivates the plugins you put in the `PLUGINS_TO_DEACTIVATE_ON_PRODUCTION` list. And if you need the reverse functionality, then check out Deactivate_Plugins_On_Staging.
Leave a Reply