WP-CLI is a command-line interface which saves developer’s time by executing WordPress tasks with only a few lines of code. It is efficient because you don’t need to use GUI by starting your browser and logging in to the site. You can also perform commands for actions which don’t have an equivalent web UI.

The main goal of the WP-CLI is to speed up WordPress developer’s workflow. WP-CLI is distributed as a phar file (short for PHP archive). It packages multiple PHP files and resources in a single application. In order to install it, you must have SSH (Secure Shell) access (credentials to log into the server as the root user or a user with sudo privileges) and your environment must meet the following minimum requirements:

  • PHP 5.4 or later
  • WordPress 3.7 or later
  • UNIX-like environment (OS X, Linux, FreeBSD, Cygwin) as support is limited in Windows environment

Note that SSH is a very powerful tool and you must use it with caution. If you aren’t careful, you could break your site. Always ensure that you have made backup prior using it.

Connect to an SSH server

  • If you use shared hosting, check if SSH access is enabled and follow your hosting provider’s instructions to obtain credentials.
  • UNIX users can use the built-in SSH client (OpenSSH) in their terminal with the following command:
ssh user@vps-ip-address -p vps-port
  • Windows users must install a third-party application – SSH client (PuTTy for example).

Installation of WP-CLI (for UNIX-like environment)

  • In the command shell, download the wp-cli.phar file using wget or curl (the archive will be downloaded to the current directory):
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  • Make the file executable:
chmod +x wp-cli.phar
  • Make the wp command available:
sudo mv wp-cli.phar /usr/local/bin/wp

If you are on Windows or something goes wrong, refer to the basic instructions or the alternative installation methods.

Usage of WP-CLI

The main unit of the WP-CLI functionality is the command. The WP-CLI commands always start with wp followed by a command or subcommand and required or optional parameters.

wp command subcommand requiredparameter –optionalparameter

Note that WP-CLI will work with the WordPress installation at which you are currently in the terminal. So if you want to use another WordPress installation you should switch to its directory.

WP-CLI has various bundled commands, which allow you to complete regular administrative tasks like WordPress installation, upgrades, database backup creation, plugins and themes installations and removals, publishing and deleting posts, changing site’s settings and managing users, WP-Cron events and schedules.

WP-CLI also offers rich internal API for integrating third-party commands. They can be defined in plugins and themes or easily scaffolded as standalone projects.

To see a full list of available commands you can type:

wp help

The output should resemble:

WP-CLI help command output

Up and down arrow keys will let you scroll through the entire help command list. Typing q will exit the help menu. For additional details on how to navigate through the complete help section, you can type h at the above prompt.

You can also get help on specific command or subcommand:

wp help [<command>] [<subcommand>]


  • Install WordPress:
wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword [email protected]
  • Update all plugins:
wp plugin update –all
  • Deactivate plugin:
wp plugin deactivate mypluginname
  • Manage WP-Cron list:
wp cron event list
  • Control maintenance mode:
wp maintenance-mode deactivate


WP-CLI makes the handling of repetitive tasks easier and faster. It is the developer’s dream come true because it allows to create test sites in seconds and to do all sorts of import/export magic. You can even run bash scripts to automate tasks. Site managers can do updates and other tasks on a number of client sites at once and save valuable time.

Was this article helpful?