lukasbesch / disable-plugins
v1.4.0
2023-02-06 12:11 UTC
Requires
- php: >=5.6
- composer/installers: ^1.4|^2.0
Requires (Dev)
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2023-02-06 12:14:52 UTC
README
定义一个插件数组,在特定环境中自动禁用(例如开发环境中的缓存插件)。
灵感来源于 Kamil Grzegorczyk 的这篇博客 文章。使用了 分支 DisablePlugins
类,该类由 Mark Jaquith 编写。
安装
此插件旨在与基于 Bedrock 的站点一起使用,并且不会与标准WordPress安装一起工作。
$ composer require lukasbesch/bedrock-plugin-disabler
它将以 wordpress-muplugin
的形式安装。
如果您尝试将其作为普通插件激活,则插件将自动停用并显示通知。
手动安装(不推荐)
下载 最新版本 并将其放置在您的 web/app/mu-plugins
文件夹中。
使用
在您首选的环境配置中(例如 config/environments/development.php
)定义常量 DISABLED_PLUGINS
,并用您要禁用的插件主文件数组。
Config::define('DISABLED_PLUGINS', [ 'autoptimize/autoptimize.php', 'updraftplus/updraftplus.php', 'wp-super-cache/wp-cache.php', 'w3-total-cache/w3-total-cache.php', ]);
如果您有较旧的Bedrock安装(< 1.9.0),您必须使用常规的 define()
函数定义常量
if (! defined('DISABLED_PLUGINS') define('DISABLED_PLUGINS', [ 'autoptimize/autoptimize.php', ]); }
PHP 5.6+ 可以在常量中存储数组,但您也可以提供序列化数据
Config::define('DISABLED_PLUGINS', serialize([ 'autoptimize/autoptimize.php', ]));