WP-CLI ====== [WP-CLI](https://wp-cli.org/) is the command-line interface for [WordPress](https://wordpress.org/). You can update plugins, configure multisite installations and much more, without using a web browser. Ongoing maintenance is made possible by:
The current stable release is [version 2.12.0](https://make.wordpress.org/cli/2025/05/07/wp-cli-v2-12-0-release-notes/). For announcements, follow [@wpcli on X](https://x.com/wpcli) or [sign up for email updates](https://make.wordpress.org/cli/subscribe/). [Check out the roadmap](https://make.wordpress.org/cli/handbook/roadmap/) for an overview of what's planned for upcoming releases. [](https://github.com/wp-cli/automated-tests/actions/workflows/testing.yml) [](https://isitmaintained.com/project/wp-cli/wp-cli "Average time to resolve an issue") [](https://isitmaintained.com/project/wp-cli/wp-cli "Percentage of issues still open") Quick links: [Using](#using) | [Installing](#installing) | [Support](#support) | [Extending](#extending) | [Contributing](#contributing) | [Credits](#credits) ## Using WP-CLI provides a command-line interface for many actions you might perform in the WordPress admin. For instance, `wp plugin install --activate` ([doc](https://developer.wordpress.org/cli/commands/plugin/install/)) lets you install and activate a WordPress plugin: ```bash $ wp plugin install user-switching --activate Installing User Switching (1.0.9) Downloading installation package from https://downloads.wordpress.org/plugin/user-switching.1.0.9.zip... Unpacking the package... Installing the plugin... Plugin installed successfully. Activating 'user-switching'... Plugin 'user-switching' activated. Success: Installed 1 of 1 plugins. ``` WP-CLI also includes commands for many things you can't do in the WordPress admin. For example, `wp transient delete --all` ([doc](https://developer.wordpress.org/cli/commands/transient/delete/)) lets you delete one or all transients: ```bash $ 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](https://make.wordpress.org/cli/handbook/quick-start/). Or, catch up with [shell friends](https://make.wordpress.org/cli/handbook/shell-friends/) to learn about helpful command line utilities. Already feel comfortable with the basics? Jump into the [complete list of commands](https://developer.wordpress.org/cli/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 for most users. Should you need, see also our documentation on [alternative installation methods](https://make.wordpress.org/cli/handbook/installing/) ([Composer](https://make.wordpress.org/cli/handbook/installing/#installing-via-composer), [Homebrew](https://make.wordpress.org/cli/handbook/installing/#installing-via-homebrew), [Docker](https://make.wordpress.org/cli/handbook/installing/#installing-via-docker)). Before installing WP-CLI, please make sure your environment meets the minimum requirements: - UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment - PHP 5.6 or later - WordPress 3.7 or later. Versions older than the latest WordPress release may have degraded functionality Once you've verified requirements, download the [wp-cli.phar](https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar) file using `wget` or `curl`: ```bash curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar ``` Next, check the Phar file to verify that it's working: ```bash 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: ```bash 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`: ```bash $ wp --info OS: Linux 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 Shell: /usr/bin/zsh PHP binary: /usr/bin/php8.1 PHP version: 8.1.0 php.ini used: /etc/php/8.1/cli/php.ini MySQL binary: /usr/bin/mysql MySQL version: mysql Ver 8.0.27-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)) SQL modes: WP-CLI root dir: /home/wp-cli/ WP-CLI vendor dir: /home/wp-cli/vendor WP_CLI phar path: WP-CLI packages dir: /home/wp-cli/.wp-cli/packages/ WP-CLI global config: WP-CLI project config: /home/wp-cli/wp-cli.yml WP-CLI version: 2.12.0 ``` ### Updating You can update WP-CLI with `wp cli update` ([doc](https://developer.wordpress.org/cli/commands/cli/update/)), or by repeating the installation steps. If WP-CLI is owned by root or another system user, you'll need to run `sudo wp cli update`. 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. ### Tab completions WP-CLI also comes with a tab completion script for Bash and ZSH. Just download [wp-completion.bash](https://raw.githubusercontent.com/wp-cli/wp-cli/v2.12.0/utils/wp-completion.bash) and source it from `~/.bash_profile`: ```bash source /FULL/PATH/TO/wp-completion.bash ``` Don't forget to run `source ~/.bash_profile` afterwards. If using zsh for your shell, you may need to load and start `bashcompinit` before sourcing. Put the following in your `.zshrc`: ```bash autoload bashcompinit bashcompinit source /FULL/PATH/TO/wp-completion.bash ``` ## Support WP-CLI's maintainers and contributors have limited availability to address general support questions. The [current version of WP-CLI](https://make.wordpress.org/cli/handbook/roadmap/) is the only officially supported version. When looking for support, please first search for your question in these venues: * [Common issues and their fixes](https://make.wordpress.org/cli/handbook/common-issues/) * [WP-CLI handbook](https://make.wordpress.org/cli/handbook/) * [Open or closed issues in the WP-CLI GitHub organization](https://github.com/issues?utf8=%E2%9C%93&q=sort%3Aupdated-desc+org%3Awp-cli+is%3Aissue) * [Threads tagged 'WP-CLI' in the WordPress.org support forum](https://wordpress.org/support/topic-tag/wp-cli/) * [Questions tagged 'WP-CLI' in the WordPress StackExchange](https://wordpress.stackexchange.com/questions/tagged/wp-cli) If you didn't find an answer in one of the venues above, you can: * Join the `#cli` channel in the [WordPress.org Slack](https://make.wordpress.org/chat/) to chat with whomever might be available at the time. This option is best for quick questions. * [Post a new thread](https://wordpress.org/support/forum/wp-advanced/#new-post) in the WordPress.org support forum and tag it 'WP-CLI' so it's seen by the community. GitHub issues are meant for tracking enhancements to and bugs of existing commands, not general support. Before submitting a bug report, please [review our best practices](https://make.wordpress.org/cli/handbook/bug-reports/) to help ensure your issue is addressed in a timely manner. Please do not ask support questions on X. X isn't an acceptable venue for support because: 1) it's hard to hold conversations in under 280 characters, and 2) X isn't a place where someone with your same question can search for an answer in a prior conversation. Remember, libre != gratis; the open source license grants you the freedom to use and modify, but not commitments of other people's time. Please be respectful, and set your expectations accordingly. ## Extending A **command** is the atomic unit of WP-CLI functionality. `wp plugin install` ([doc](https://developer.wordpress.org/cli/commands/plugin/install/)) is one command. `wp plugin activate` ([doc](https://developer.wordpress.org/cli/commands/plugin/activate/)) is another. WP-CLI supports registering any callable class, function, or closure as a command. It reads usage details from the callback's PHPdoc. `WP_CLI::add_command()` ([doc](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-add-command/)) is used for both internal and third-party command registration. ```php /** * Delete an option from the database. * * Returns an error if the option didn't exist. * * ## OPTIONS * *