A command line interface for WordPress
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
The goal of WP-CLI is to provide a command-line interface for any action you can perform in the WordPress admin. The project also includes commands for many actions you can't perform in the WordPress admin.
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 transient (doc) lets you delete one or all transients:
$ wp transient delete-all Success: 34 transients deleted from the database.
For a complete introduction, read the Quick Start guide. If you already feel comfortable with the basics, jump into the complete list of commands for managing themes and plugins, importing and exporting data, performing database search-replace operations and more.
The recommended way to install WP-CLI is to download the Phar build, mark it executable and place it in your PATH. See also our documentation on alternative installation methods.
Before you install though, please make sure your environment meets the minimum requirements:
- UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment
- PHP 5.3.29 or later
- WordPress 3.7 or later
Download the wp-cli.phar using
curl. For example:
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Check if it is working:
$ php wp-cli.phar --info
To use it 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 installed successfully, you should see something like this when you run
$ 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
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.
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.
Besides the libraries defined in composer.json, we have used code or ideas from the following projects: