Home
Softono

Bedrock Plugin Disabler

Open source PHP
54
Stars
7
Forks
1
Issues
3
Watchers
7 months
Last Commit

 About Bedrock Plugin Disabler

Disable certain plugins in non-production environments using PHP constants.

Platforms

Web Self-hosted

Languages

PHP

Links

Need Help Installing Bedrock Plugin Disabler?

We provide expert installation service for this software. Our team will install, configure, and secure Bedrock Plugin Disabler on your server. plans start at just $30.

Bedrock Plugin Disabler

View on GitHub

Bedrock Plugin Disabler

Packagist Supported PHP Versions GitHub Repository Size Build Status Downloads

Define an array of plugins that deactivate automatically in certain environments (e.g. caching plugins in development).

Inspired by this blog post by Kamil Grzegorczyk. Uses a fork of the DisablePlugins class written by Mark Jaquith.

Installation

This plugin is designed to work with Bedrock based sites, and will not work with a Standard WordPress installation.

$ composer require lukasbesch/bedrock-plugin-disabler

It will be installed as a wordpress-muplugin.
If you try to activate it as a regular plugin, the plugin will deactivate itself with a notice.

Manual Installation (not recommended)

Download the latest release and place it in your web/app/mu-plugins folder.

Usage

Define the constant DISABLED_PLUGINS with an array of the plugins main files you want to deactivate in your preferred environment configuration, for example config/environments/development.php:

Config::define('DISABLED_PLUGINS', [
    'autoptimize/autoptimize.php',
    'updraftplus/updraftplus.php',
    'wp-super-cache/wp-cache.php',
    'w3-total-cache/w3-total-cache.php',
]);

If you have an older Bedrock installation (< 1.9.0) you have to define the constant using the regular define() function:

if (! defined('DISABLED_PLUGINS')
    define('DISABLED_PLUGINS', [
        'autoptimize/autoptimize.php',
    ]);
}

You can also provide serialized data:

Config::define('DISABLED_PLUGINS', serialize([
    'autoptimize/autoptimize.php',
]));