Topic in WP-CLI

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.

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:

  1. Connect to your site using SSH.
  2. Switch to your site's main directory with the following command, replacing with the primary domain of the site you want to manage:
    cd ~/sites/
  3. Finally, test that WP-CLI is working properly and view a list of the available commands with the following:
    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:

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:

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


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.

Related Topics

  • Using WP-CLI Command Line Tools
    All VPS and Enterprise plans come with a powerful command line tool known as WP-CLI. For an overview of basic command...

  • WP-CLI Database Commands
    WP-CLI has some powerful tools built in for database management, here are some of the most used/convenient features. ...

  • Multisite Database Commands
    NOTE: These commands are for subfolder multisite only. If you are using multiple domains in your sub sites please con...

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Powered by Zendesk