Using WP-CLI Command Line Tools
Last Updated -
All VPS and Enterprise plans come with a powerful command line tool known as WP-CLI. For an overview of basic commands, open terminal and enter the following.
Since WP-CLI is installed by default on all VPS/Enterprise accounts, using it is easy. Here's how to do it:
- Connect to your site using SSH.
- Switch to your site's main directory with the following command, replacing example.com with the primary domain of the site you want to manage:
- Finally, test that WP-CLI is working properly and view a list of the available commands with the following:
Accessing Help Documentation
Every command, sub-command, and parameter inside WP-CLI is available with the --help parameter. For example, if you want to see all of the available commands inside WP-CLI, run the following:
But what if you're looking for more information on a particular command? Since the --help parameter is global, you can run it on an individual command like this:
wp plugin --help
If you run the above command, you'll see deeper information on the plugin WP-CLI command, such as subcommands and additional parameters that are available for that particular command.
Common WP-CLI Commands
Viewing WordPress Plugin Details
Display information about your current plugins, including details about which plugins are active/inactive and if they have an update available.
wp plugin status
Viewing WordPress Theme Details
Display a list of installed themes, your active theme and updates available.
wp theme status
Search and Replace Inside Your WordPress Database
Search for a value with your database and replace it with something else.
wp search replace
Open a Command Line MySQL Client
Open a MySQL command line client to interact with the database.
wp db query
Nearly all common WordPress functions are available in wp-cli for a full list and updates of new commands that become available you can check the official WP-CLI website.
Please view our WP-CLI blog post for some extra tips.