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 review the following guide.
Note: When using WP-CLI on your Pagely server, use pagely-wp
instead of wp
. This will ensure you’re using the same PHP version as the site in question and reduce the likelihood of errors.
Accessing WP-CLI
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:
cd ~/sites/example.com
- Finally, test that WP-CLI is working properly and view a list of the available commands with the following:
pagely-
wp --help
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:
pagely-wp --help
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:
pagely-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.
pagely-wp plugin status
Viewing WordPress Theme Details
Display a list of installed themes, your active theme and updates available.
pagely-wp theme status
Search and Replace Inside Your WordPress Database
Search for a value with your database and replace it with something else.
pagely-wp search-replace
Open a Command Line MySQL Client
Open a MySQL command line client to interact with the database.
pagely-wp db query
Further Reading
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.