Automatically activate plugin - Roots/Bedrock

Hello there,

Is there any way to automatically activate plugins after deploying with capistrano?

My composer.json file:

{
"repositories": [
	{
		"type": "composer",
		"url": "http://wpackagist.org"
	},
	{
		"type": "package",
		"package": {
			"type": "webroot",
				"name": "wordpress/wordpress",
				"version": "4.0",
				"dist": {
					"url": "https://github.com/WordPress/WordPress/archive/4.0.zip",
					"type": "zip"
				},
				"require": {
					"fancyguy/webroot-installer": "1.1.0"
				}
		}
	}
],
"require": {
	"fancyguy/webroot-installer": "1.1.0",
"composer/installers": "v1.0.12",
	"wordpress/wordpress": "4.0",
	"wpackagist-plugin/redux-framework":"*",
	"wpackagist-plugin/wp-admin-bar-removal":"*",
	"wpackagist-plugin/jetpack":"*"
},
"extra": {
	"installer-paths": {
		"app/plugins/{$name}/": ["type:wordpress-plugin"],
		"app/themes/{$name}/": ["type:wordpress-theme"],
		"app/mu-plugins/{$name}/": ["type:worpdress-muplugin"]
	},
	"webroot-dir": "wp",
	"webroot-package": "wordpress/wordpress"
}

}

Thanks!

Check out the mu-plugins autoloader section of the the readme.

You could also use WP-CLI to activate plugins.

1 Like

@Foxaii, correct me if I’m wrong but this will disable the plugin’s update notifications and the ability to update the plugin from the admin. Those are definitely two significant caveats.

That’s correct. It treats them as mu-plugins, hence the naming of the plugin.

The plugins are being managed by composer so you need to be able to lock down the plugin versions using the composer.json. It allows greater control over the environment.

Enabling updates in the dashboard would negate the ability to do this and potentially lead to issues.

Of course if you are leaving the client to manage the site and just come back to you when an update breaks things then the wp-cli solution is more appropriate as it will allow security updates to be applied - assuming the client knows how and is willing to risk an update when it may cost them money to sort things if something goes wrong.

3 Likes