WP Professional

WP Professional Plus

Podcast Websites

WP-CLI is a command-line tool that you can use to control your WordPress installation. You can use WP-CLI with any WordPress installation on our accounts. It can be used on fully managed WordPress hosting accounts and  PairSIM WordPress installations.

Getting Ready to Use WP-CLI

Before you can use the WP-CLI commands, you must first complete a few steps:

  1. Connect to your account via SSH. For more information about how to establish this connection, see our Connect to Your Account via SSH article.
  2. Navigate to your WordPress installation files.The default SSH location is your home directory (/usr/home/username).  You will first need to use the following command to reach your website files:
    cd public_html
  3. Once you have reached your public_html you will want to use the cd command to navigate to your WordPress installation files.  If you are unsure where this is, you can check the domain mapping within the ACC.

After you have arrived within your WordPress installation's directory, you can use WP-CLI commands.

Our version of WP-CLI requires the prefix of "wp-cli" instead of just "wp," so if you attempt to run WP-CLI commands that you found outside of this article, be sure to begin the command with "wp-cli" instead of "wp."

WP-CLI Commands

WP-CLI can be used in various aspects of your WordPress backend, from themes and plugins to cache flushing. We've broken the commands below into categories based on their purpose.

Keep in mind that this is not an exhaustive list of all WP-CLI can accomplish, but rather a helpful guide to get you started. If you want a complete list on WP-CLI commands, see the WP-CLI command documentation page.


Command Use Example
wp-cli theme list Lists the current themes that exist on the WordPress installation.

For the other commands, be sure to use the names as they appear in this list.

wp-cli theme list
wp-cli theme install [theme name] --activate Installs and activates a theme wp-cli theme install twentysixteen --activate
wp-cli theme delete [theme name] Deletes a theme wp-cli theme delete twentytwelve
wp-cli theme update [theme name] Updates the theme. This command can update multiple themes at a time. To update multiple themes, list the other theme names after the initial theme name. wp-cli theme update twentyfifteen twentysixteen
wp-cli theme status [theme name] Gets information about a theme on the WordPress installation wp-cli theme status twentysixteen


Command Use Example
wp-cli plugin list Gets a list of all plugins.

This is necessary because plugin names are not always formatted in the same way that they appear in the plugin directory.

Use the names from the list to run the following commands.

wp-cli plugin list
wp-cli plugin install [plugin]  --activate Install and activate a plugin wp-cli install woocommerce --activate
wp-cli plugin deactivate [plugin] Deactivate a plugin wp-cli plugin deactivate woocommerce
wp-cli plugin delete [plugin] Delete a plugin from your WordPress installation wp-cli plugin delete woocommerce
wp-cli plugin get [plugin] Gets plugin information wp-cli plugin get woocomerce


Command Use Example
wp-cli core version Shows the current WordPress core version wp-cli core version
wp-cli core check-update Checks for any pending WordPress core updates wp-cli core check-update
wp-cli core update If there are any pending WordPress core updates, this command will initiate the update process wp-cli core update
wp-cli core update --version=[version number] --force Forces the WordPress core to update to a specific core version

Note: Be careful using this command. Rolling back a core version can break your site and cause compatibility errors with your plugins and themes.

wp-cli core update --version=4.9 --force
wp-cli core update-db Updates WordPress databases with any pending core updates wp-cli core update-db


Command Use Example
wp-cli db check Checks the current status of the WordPress database wp-cli db check
wp-cli db tables Displays a list of all current tables in the WordPress database wp-cli db tables
wp-cli db create Creates a new WordPress database wp-cli db create
wp-cli db drop Deletes the current database wp-cli db drop
wp-cli db optimize Optimizes the current WordPress database wp-cli db optimize
wp-cli db query [query] Executes a query within your WordPress database wp-cli db query 'UPDATE wp_posts SET post_author="new-author-id" WHERE post_author = "old-author-id";'
wp-cli db search [search string] Searches the current WordPress data for the string

Note: If no instances are found, no information will be returned. 

wp-cli db search dog.jpg
wp-cli db size --size_format=[format] Displays the size of the current WordPress database.

You can change the measurement size by entering a size format in the place of [format].

See the WordPress WP-CLI DB Size developer page for all the available size formats. 

wp-cli db size --size_format=mb

Maintenance Mode

Command Use Example
wp-cli maintenance-mode status Displays whether or not maintenance mode is currently active on the WordPress site wp-cli maintenance-mode status
wp-cli maintenance-mode activate Activates maintenance mode on your current WordPress installation

Note: Visitors will be unable to access your site while maintenance mode is running.

wp-cli maintenance-mode activate
wp-cli maintenance mode deactivate Deactivates maintenance mode on your current WordPress installation wp-cli maintenance mode deactivate
Command Use Example
wp-cli menu list Displays a list of current menus on the WordPress installation wp-cli menu list
wp-cli menu create "[menu name]" Creates a new menu wp-cli menu create "New-Header-Menu"
wp-cli menu delete "[menu name]" Deletes an existing menu wp-cli menu delete "New-Header-Menu"
wp-cli menu location list Displays a list of locations available for menus wp-cli menu location list
wp-cli menu location assign [menu name] [location] Assigns the specified menu to the chosen location wp-cli menu location assign New-Header-Menu top
wp-cli menu location remove [menu name] [location] Removes the specified menu from the chosen location. wp-cli menu location remove New-Header-Menu top


Command Use Example
wp-cli post list Lists all posts on current WordPress installation, including their publish status. wp-cli post list
wp-cli post create --post_type=[page or post] --post_title='[title]' --post_status=future --post_date='YYYY-MM-DD hour:min:sec' Creates a post or page and schedules it to launch at a future date.

Note: Be sure to use 24 hour time when entering the time for post date.

wp-cli post create --post_type= post

--post_title='My Post' --post_status=future --post_date='2025-08-05 17:10:00'

wp-cli post create --post_type=[post or page] --post_title='[title]' Create and publish a post or page. wp-cli post create --post_type=page --post_title='My New Page'
wp-cli post delete [post name] --force Deletes a post, skipping the trash. wp-cli post delete My Post --force

Users and Roles

Command Use Example
wp-cli user create [user] [user email]  --role=[role] Creates a new user on the current WordPress installation. wp-cli user create jack [email protected] --role=author
wp-cli user delete [user] --reassign=[different user] Deletes an existing user and reassigns their pages and posts to another user. wp-cli user delete jack --reassign=paige
wp-cli user list Displays a list of all current users on the WordPress installation. wp-cli user list
wp-cli user reset-password [user] Resets passwords for existing users. The next time users log in, they will be prompted to enter a new password.

You can reset the password for multiple users by adding user's at the end of the command

wp-cli user reset-password admin editor
wp-cli role list Lists all available roles on the WordPress installation. wp-cli role list


Updated on September 14, 2021

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support