Here is my solution, create a plugin that can disable other plugins like so:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* * Plugin Name: Disable/Configure Plugins * Description: Lets you disable/configure plugins based on environment variables * Author: Chris Sewell */ /** * Disable specified plugins in development environment. * * This is a "Must-Use" plugin. Code here is loaded automatically before regular plugins load. * This is the only place from which regular plugins can be disabled programatically. * * Place this code in a file in WP_CONTENT_DIR/mu-plugins or specify a custom location * to "development" or "production" in each particular server/environment. */ /* Disable specified plugins in development environment */ if (((getenv('environment') == 'production') || (getenv('environment') == 'alpha')) == false) { $plugins = array( 'w3-total-cache/w3-total-cache.php' ); require_once(ABSPATH . 'wp-admin/includes/plugin.php'); deactivate_plugins($plugins); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.