tivwp/tivwp-force-deactivate-plugins

TIVWP 强制禁用插件

1.0.1 2017-04-23 04:16 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:32:00 UTC


README

自动在生产服务器上禁用插件。

如果 WP_LOCAL_DEV 定义不是 true,则禁用指定的插件。

这是 Mark Jaquith (@markjaquith) 的 CWS_Disable_Plugins_When_Local_Dev 的反向逻辑。

安装

  • 确保在你的项目的 composer.json 中有以下设置
{
	"require": {
		"composer/installers": "^1.0"
	},
	"extra": {
		"installer-paths": {
			"path/to/mu-plugins/{$name}/": [
				"type:wordpress-muplugin"
			]
		}
	}
}
  • 在项目的根目录中运行此命令
composer require tivwp/tivwp-force-deactivate-plugins
  • 插件文件将安装到 path/to/mu-plugins/tivwp-force-deactivate-plugins 文件夹中。然而,WordPress 忽略 mu-plugins 下的子文件夹。因此,你需要将 tivwp-force-deactivate-plugins.php 复制到一层的 mu-plugins 中。

设置

  • 将此放入本地配置文件(例如,排除在仓库之外)
define( 'WP_LOCAL_DEV', true );
  • 并此 - 到 wp-config.php 中(当然,编辑)
define( 'TIVWP_LOCAL_DEV_PLUGINS', array(
   'debug-bar/debug-bar.php',
   'query-monitor/query-monitor.php',
   'tivwp-email/tivwp-email.php',
) );

作者

  • Gregory Karpinsky (@tivnet)

许可协议

GPL-3.0