Using WP-CLI with WordPress Hosting

Applies to:
WordPress Hosting

Difficulty:
Easy

Time Needed:
5 minutes

Introduction

This is a quick guide to running WP-CLI on your WordPress Hosting account.

WP-CLI allows you to manage your WordPress site from the command line and is installed on all our WordPress hosting accounts. This may be useful if you need to make quick checks on sites, or for more advanced scripting usage.



How to run WP-CLI on WordPress Hosting


Step 1

Configure SSH access to your account

Shell access to your account uses the same details as FTP, so you may need to follow our guide on 'How to Manage Your FTP Access Details', in order to update your password. You will also need to unlock your FTP account.

Configure SSH access to your account

Step 2

Connect to your account using SSH

You will need to connect to your account using SSH in order to access WP-CLI. Exactly how to do this will depend on the operating system that you are using.

Windows
You should use a client such as PuTTY.

Mac OS X
The ssh command is available from Terminal (Applications > Utilities > Terminal).

To connect, you should access your account with your FTP username. In this example, the username is 'user'.

Once connected, you will need to change directory into httpdocs, by typing the following:

cd httpdocs
Connect to your account using SSH

Step 3

Use WP-CLI

WP-CLI is already installed on your account, and can be accessed simply by typing:

wp

If you press enter at this point, you’ll be shown a screen of help, which you can close by pressing 'q'.

You can manipulate plugins, themes, users and more using WP-CLI. We’ll show how to install a new plugin. First, type the following:

wp plugin list

This will check to see what plugins are installed, along with their version and status.

Use WP-CLI

Step 4

Install a plugin

Let’s install the plugin hello-world, by using the command:

wp plugin install hello-world

You’ll notice a couple of PHP warnings. These can safely be ignored.

As usual, after installing a WordPress plugin it needs to be activated. We can do that from WP-CLI too, by using the following command:

wp plugin activate hello-world
Install a plugin

Further information

WP-CLI is a very capable tool, and can do far more than we have covered in this knowledge base article. You can find a full command reference on the official WP-CLI website.


Was this helpful?

   
90 people found this article helpful