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:
- UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment
- PHP 5.3.29 or later
- WordPress 3.7 or later
Once you’ve verified requirements, download the wp-cli.phar file using
$ 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 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: 1.1.0
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 --activate (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.
Here are some helpful guides and resources for using WP-CLI.
Can’t find what you’re looking for? Open an issue to request improvements.
- Installing – Recommended and alternative installation mechanisms.
- Quick start – Where to begin after you’ve installed WP-CLI for the first time.
- Commands cookbook – The full 101 how commands work, writing your own, and sharing them with the world.
- Common issues and their fixes – In case of fire, break glass.
- External resources – Blog posts, slides and videos from users.
- Global parameters – Variables defining how a command is executed, including which WordPress user the command is run as and which WordPress instance the command is run against.
- Built-in commands – Commands included in every copy of WP-CLI.
- Package index – Commands maintained and supported by the community.
- Internal API – Stable utilities considered safe to use in community commands.
- Documentation standards – Standards for annotating WP-CLI commands.
- Hosting companies – List of hosting companies where WP-CLI is installed by default.
- Shell friends – Helpful shortcuts for bash and zsh.
- Integrated tools – Plugins, wrappers, and other projects that integrate with WP-CLI in some form.
WP-CLI A command line interface for WordPress
Latest posts by David (see all)
- Top 15 Free and Responsive WordPress Themes - 20/05/2017
- 15 Best Free Fonts for Your Inspiration - 15/05/2017
- 50+ Essential Tips for WordPress Website Maintenance - 10/05/2017