InMotion Hosting Support Center

In this tutorial:

If you run a WordPress website you can use WP-CLI or WordPress Command Line Interface to manage your site. This can make quick work out of updating plugins, setting up multisites, and much more without a web-browser.

If you have a lot of WordPress sites to manage, or would just like to become more efficient in your common WordPress tasks, learning to use WP-CLI is a great time investment.

A common scenario a WordPress administrator might run into, is updating all of the plugins across all of their various WordPress installations. With WP-CLI it's as easy as typing: wp plugin update --all

Install WordPress WP-CLI

To use WP-CLI you just need SSH access, PHP 5.3.2 or later, and at least WordPress 3.5.2.

  1. First you need to download wp-cli.phar using either wget or curl after you login with SSH.

    curl -O


    Using wget if you get an error about the SSL certificate mis-match between and domains, you can skip the certificate check to download the file with:

    wget --no-check-certificate

  2. Then test WP-CLI directly with PHP with this command:

    php wp-cli.phar --info

    You should see output similar to:

    PHP binary: /usr/local/bin/php
    PHP version: 5.4.28
    php.ini used: /usr/local/lib/php.ini
    WP-CLI root dir: phar://wp-cli.phar
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 0.15.1

  3. Next you'll want to make the WP-CLI file executable and move it to your path:

    chmod +x wp-cli.phar
    mv wp-cli.phar /usr/local/bin/wp

  4. Now you can simply use wp at the command line to access WP-CLI:

    wp --info

Setup bash tab completion for WP-CLI

A great time saving feature of command line interfaces is using tab completion to quickly type in commands. You can add the ability to use tab completion for WP-CLI by setting it up in your local ~/.bash_profile file.

  1. Download the WP-CLI tab completion file to your server.

    curl -O


    Using wget if you get an error about the SSL certificate mis-match between and domains, you can skip the certificate check to download the file with:

    wget --no-check-certificate

  2. Move the WP-CLI tab completion file to your home directory:

    mv wp-completion.bash ~/

  3. Now edit your ~/.bash_profile file to include the WP-CLI tab completion file:

    vi ~/.bash_profile

  4. Add this line to the bottom of your ~/.bash_profile file:

    source ~/wp-completion.bash

    Now save this file

  5. Back at the command line, make sure to source your ~/.bash_profile file with this:

    source ~/.bash_profile

  6. Now just type wp at the prompt, and hit Tab twice to see all the tab completions you just setup:

    root@server [/home/example/public_html]# wp
    cache comment eval help menu plugin role shell super-admin transient
    cap core eval-file import network post scaffold sidebar term user
    cli db export media option rewrite search-replace site theme widget

Using the WordPress WP-CLI to manage a site

Now that you have WP-CLI installed on your server, you can begin using it to manage your WordPress installs.

  1. The first thing you need to do is navigate to the directory of a WordPress install:

    cd ~example/public_html/wordpress

  2. Now you can have WP-CLI spit back options for the type of activity you'd like to do. For instance if you'd like to manage the plugins of your WordPress install you can simply run:

    wp plugin

    You'll get a nice help listing of all the things you can do with plugins:

    usage: wp plugin activate <plugin>... [--network]
    or: wp plugin deactivate [<plugin>...] [--all] [--network]
    or: wp plugin delete <plugin>...
    or: wp plugin get <plugin> [--field=<field>] [--format=<format>]
    or: wp plugin install <plugin|zip|url>... [--version=<version>] [--force] [--activate] [--activate-network]
    or: wp plugin is-installed <plugin>
    or: wp plugin list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>]
    or: wp plugin path [<plugin>] [--dir]
    or: wp plugin search <search> [--per-page=<per-page>] [--field=<field>] [--fields=<fields>] [--format=<format>]
    or: wp plugin status [<plugin>]
    or: wp plugin toggle <plugin>... [--network]
    or: wp plugin uninstall <plugin>... [--no-delete]
    or: wp plugin update [<plugin>...] [--all] [--version=<version>] [--dry-run]
    See 'wp help plugin <command>' for more information on a specific command.

  3. So let's just first list the currently installed plugins on our WordPress site:

    wp plugin list
    | name | status | update | version |
  4. We can see this WordPress install currently has no plugins installed, let's change that:

    wp plugin install hello-dolly
    Installing Hello Dolly (1.6)
    Downloading install package from
    Using cached file '/root/.wp-cli/cache/plugin/'...
    Unpacking the package...
    Installing the plugin...
    Plugin installed successfully.
    wp plugin install wp-super-cache
    Installing WP Super Cache (1.4)
    Downloading install package from
    Unpacking the package...
    Installing the plugin...
    Plugin installed successfully.
    wp plugin list
    | name           | status   | update | version |
    | hello-dolly    | inactive | none   | 1.6     |
    | wp-super-cache | inactive | none   | 1.4     |
  5. We can even take it a step further and go ahead and activate these plugins as well:

    wp plugin activate hello-dolly
    Success: Plugin 'hello-dolly' activated.
    wp plugin activate wp-super-cache
    Success: Plugin 'wp-super-cache' activated.
    wp plugin list
    | name           | status | update | version |
    | hello-dolly    | active | none   | 1.6     |
    | wp-super-cache | active | none   | 1.4     |

There is a lot more that you can do with WP-CLI and this was just a short intro to get you going. Be sure to check back often as we update our documentation on managing WordPress from the command line!

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
13,791 Points
2016-01-29 9:00 am
I would not recommend updating plugins daily. The problem exists in conflicts and upgrades. You want to be able to upgrade the plugins and immediately test to ensure everything in functioning properly. Also, prior to upgrading it's bests practices to backup your site. That way if anything goes wrong in the upgrade, you can restore it accordingly. It really comes down to personal preferences.
n/a Points
2016-01-28 10:28 pm

This is great. Never knew it existed. Is there any compelling reason NOT to put "wp plugin update --all" into a cron job to run daily?


n/a Points
2014-10-22 8:45 am

Managing multiple WordPress websites is a hectic job, as you have to logging to each site and setup/install plugins and settings for each site independently. 

Luckily for those well versed to work in command line, they can use WP-CLI to manage multiple WordPress sites with just a few commands. WP-CLI comes with built-in commands specific just to manage WordPress websites. 

Through WP-CLI you can install, manage plugins and themes. Control settings such as cron-job, comments etc. 

n/a Points
2014-06-25 2:53 pm
# wget
--2014-06-25 14:52:09--
Connecting to||:443... connected.
ERROR: certificate common name `' doesn't match requested host name `'.
To connect to insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
9,968 Points
2014-06-25 3:23 pm
Hello Robert,

It seems like GitHub is using the SSL certificate for also on their domain, and wget is seeing this mis-match and warning you much like a web-browser would.

You can bypass this in wget as the error message says by using --no-check-certificate:

wget --no-check-certificate

Or you could also use curl which doesn't check the certificate in this way:

curl -O

Please let us know if you're still having any issues, and thanks for letting us know about this problem so we can update this guide.

- Jacob

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

5 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!