Roots and WP Packages are independent open source projects, supported only by developers like you. We’ve been improving the WordPress developer experience since 2011, and your support keeps it independent.
Disable Plugins Based on Environment
Bedrock supports defining an environment with the WP_ENV environment variable. A typical setup for a project could contain several different environments:
developmentfor local developmentstagingfor a staging environmentproductionfor the live/production environment
In some cases, you may want to enforce certain plugins to be deactivated on one or more of your environments.
The Bedrock Plugin Disabler mu-plugin package by @luke can be used to configure a list of disabled plugins in your Bedrock environment configs located in config/environments/.
Install the mu-plugin with Composer:
$ composer require lukasbesch/bedrock-plugin-disabler
This package requires defining a DISABLED_PLUGINS constant with an array of plugin filenames to be disabled.
Disabling plugins on local development
The most common use-case is disabling caching plugins on local development. We'll cover disabling WP Rocket and WP Super Cache in the following example.
Open config/environments/development.php and add the DISABLED_PLUGINS constant:
Config::define('DISABLED_PLUGINS', [
'wp-rocket/wp-rocket.php',
'wp-super-cache/wp-cache.php',
]);
Last updated