WP-CLI

A command line interface for WordPress

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

To stay up to date, follow @wpcli on Twitter or sign up for our email newsletter.

Build Status Dependency Status Average time to resolve an issue Percentage of issues still open

A more RESTful WP-CLI aims to unlocking the potential of the WP REST API at the command line. Project backed by Pressed, Chris Lema, Human Made, Pagely, Pantheon and many others. Learn more →

Quick links: Using | Installing | Support | Extending | Contributing | Credits

Using

WP-CLI’s goal is to provide a command-line interface for any action you might want to perform in the WordPress admin. For instance, wp plugin install (doc) lets you install and activate a WordPress plugin:

$ wp plugin install rest-api --activate
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.

WP-CLI also includes commands for many things you can’t do in the WordPress admin. For example, wp transient delete-all (doc) lets you delete one or all transients:

$ wp transient delete-all
Success: 34 transients deleted from the database.

For a more complete introduction to using WP-CLI, read the Quick Start guide.

Already feel comfortable with the basics? Jump into the complete list of commands for detailed information on managing themes and plugins, importing and exporting data, performing database search-replace operations and more.

Installing

Downloading the Phar file is our recommended installation method. Should you need, see also our documentation on alternative installation methods.

Before installing WP-CLI, please make sure your environment meets the minimum requirements:

Once you’ve verified requirements, download the wp-cli.phar file using wget or curl:

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Next, check if it is working:

$ php wp-cli.phar --info

To use WP-CLI from the command line by typing wp, make the file executable and move it to somewhere in your PATH. For example:

$ chmod +x wp-cli.phar
$ sudo mv wp-cli.phar /usr/local/bin/wp

If WP-CLI was installed successfully, you should see something like this when you run wp --info:

$ wp --info
PHP binary:    /usr/bin/php5
PHP version:    5.5.9-1ubuntu4.14
php.ini used:   /etc/php5/cli/php.ini
WP-CLI root dir:        /home/wp-cli/.wp-cli
WP-CLI packages dir:    /home/wp-cli/.wp-cli/packages/
WP-CLI global config:   /home/wp-cli/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 0.23.0

You can update WP-CLI with wp cli update (doc), or by repeating the installation steps.

Want to live life on the edge? Run wp cli update --nightly to use the latest nightly build of WP-CLI. The nightly build is more or less stable enough for you to use in your development environment, and always includes the latest and greatest WP-CLI features.

Support

WP-CLI’s maintainers and project contributors do their best to respond to all new issues in a timely manner. To make the best use of their volunteered time, please first see if there may be an answer to your question in one of the following resources:

If you have a WordPress.org account, you may also consider joining the #cli channel on the WordPress.org Slack organization.

Extending

A command is an atomic unit of WP-CLI functionality. wp plugin install (doc) is one command. wp plugin activate (doc) is another.

WP-CLI comes with dozens of commands. It’s easier than it looks to create a custom WP-CLI command. Read the commands cookbook to learn more. Browse the internal API docs to discovery a variety of helpful functions you can use in your custom WP-CLI command.

Contributing

To get involved, please first read about creating an issue or submitting a pull request.

Leadership

Read more about the project’s governance and view a complete list of contributors.

Credits

Besides the libraries defined in composer.json, we have used code or ideas from the following projects: