Page tree
Skip to end of metadata
Go to start of metadata

What is WP-CLI?

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multi-site installs and much more, without using a web browser.

curl -O https://raw.githubusercontent.com/wp...ar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
 

If you are using CageFS, you will need the below steps:

 

echo -en '[WP-Cli]\ncomment=Allow WP-CLI to work on the server\npaths=/usr/local/bin/wp\n' > /etc/cagefs/conf.d/wpcli.cfg
cagefsctl --update
 

Once the above steps have finished without any errors, the command line can be accessed by typing wp in your directory that WordPress is installed to.

Installing and activating plugins via WP-CLI

 

$wp plugin install rest-api --activate   #install and activate the plugin test-api
Installing WordPress REST API (Version 2) (2.0-beta13)
Downloading install package from https://downloads.wordpress.org/plugin/rest-api.2.0-beta13.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'rest-api'...
Success: Plugin 'rest-api' activated.

 

Below are some commonly used commands:

 

# Install the development version from wordpress.org
$ wp plugin install bbpress --version=dev

# Install from a local zip file
$ wp plugin install path_to_the_plugin.zip

# Install from a remote zip file
$ wp plugin install remote_path

#List all installed plugins
$ wp plugin list 

#Getting help of any command
$ wp help cli/plugin
  • No labels