Activating and deactivating WordPress plugins from a shell script (BASH)

I needed to update my WordPress site provisioning script to download, install and activate a WordPress plugin. The download is the easy part (I just use wget). But how do I activate the plugin. This is what I cam up with:

result=$(php -r 'require_once("./wp-load.php");require_once("wp-admin/includes/admin.php");activate_plugin("hello.php");')

And to be complete, to deactivate:

result=$(php -r 'require_once("./wp-load.php");require_once("wp-admin/includes/admin.php");deactivate_plugins("hello.php");')


Comments are closed.

Powered by WordPress. Designed by WooThemes