We’re thrilled to announce EarlyDog, our fully managed hosting on Google Cloud servers EarlyDog: managed hosting on Google Cloud

← ServerPilot Docs

How to Manage WordPress Plugins with WP-CLI

WP-CLI offers a quick and powerful way to manage your WordPress plugins using the command line over SSH.

Disabling plugins from the command line is especially useful if the wp-admin area is inaccessible due to a broken configuration.

First, SSH in to your server as your WordPress app's system user; do not use root with WP-CLI as it could break your app.

Then, navigate to your app's public directory by entering the following commands, replacing "APPNAME" with your app's name:

cd apps
cd public

Now, type wp plugin and press Enter. You'll be given a list of the acceptable arguments for this command:

usage: wp plugin activate [<plugin>...] [--all] [--network]
   or: wp plugin deactivate [<plugin>...] [--uninstall] [--all] [--network]
   or: wp plugin delete <plugin>...
   or: wp plugin get <plugin> [--field=<field>] [--fields=<fields>] [--format=<format>]
   or: wp plugin install <plugin|zip|url>... [--version=<version>] [--force] [--activate] [--activate-network]
   or: wp plugin is-installed <plugin>
   or: wp plugin list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>]
   or: wp plugin path [<plugin>] [--dir]
   or: wp plugin search <search> [--page=<page>] [--per-page=<per-page>] [--field=<field>] [--fields=<fields>] [--format=<format>]
   or: wp plugin status [<plugin>]
   or: wp plugin toggle <plugin>... [--network]
   or: wp plugin uninstall <plugin>... [--deactivate] [--skip-delete]
   or: wp plugin update [<plugin>...] [--all] [--format=<format>] [--version=<version>] [--dry-run]

See 'wp help plugin <command>' for more information on a specific command.

This article will cover the most common uses for wp plugin.

To List All Installed Plugins

Enter this command to see an overview of the state of your installed plugins:

wp plugin list

The output will look similar to the following:

| name    | status   | update | version |
| akismet | inactive | none   | 3.3     |
| hello   | inactive | none   | 1.6     |

This displays the official name of each of your plugins, the current status, available updates, and the installed version.

To Install a New Plugin

Enter this command to install a new theme, replacing "PLUGINNAME" with the name of the plugin you would like to install:

wp plugin install PLUGINNAME

This will give you an output similar to the following as your plugin is installed:

Installing Jetpack by WordPress.com (4.8.2)
Downloading install package from https://downloads.wordpress.org/plugin/jetpack.4.8.2.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.

You can activate the plugin at installation by amending the command like this:

wp plugin install PLUGINNAME --activate

To Activate a Plugin

Enter this command to activate a plugin:

wp plugin activate PLUGINNAME

You will receive a message similar to this upon success:

Plugin 'hello' activated.
Success: Activated 1 of 1 plugins.

To Update One Plugin

Enter this command to easily update one plugin:

wp plugin update PLUGINNAME

The system will show a success or failure message.

To Update All Plugins

You can update all of your plugins by entering this command:

wp plugin update --all

The system will show a success or failure message for each installed plugin.

To Deactivate One Plugin

Enter this command to deactivate one plugin:

wp plugin deactivate PLUGINNAME

To Deactivate All Plugins

You can deactivate all of your plugins by entering this command:

wp plugin deactivate --all

Deactivating your plugins will not delete the plugins; it will only make them inactive. The system will show each plugin as deactivated. The system will also note any failures and provide a summary of the successfully deactivated plugins, similar to this:

Plugin 'akismet' deactivated.
Plugin 'hello' deactivated.
Plugin 'jetpack' deactivated.
Success: Deactivated 3 of 3 plugins.

To Delete One Plugin

Enter this command to delete a plugin:

wp plugin delete PLUGINNAME

You will receive a result similar to the following:

Deleted 'jetpack' plugin.
Success: Deleted 1 of 1 plugins.

It is not necessary to deactivate a plugin before deleting it.

You can find more information in the official WP-CLI documentation.

Last updated: July 18, 2017

Launch your first site in 5 minutes