Work Faster With WordPress: How To Get Started With WP-CLI

If you’re a regular WordPress user, you may find certain repetitive tasks taking up a bit more time than you’d like. Thankfully, by taking a little time to learn “WP-CLI”, you can significantly speed up regular WordPress tasks and save yourself countless future hours.

WP-CLI stands for WordPress Command Line Interface. It’s an extremely powerful tool for interacting with and managing WordPress sites. It’s done via command line (such as Terminal in Mac, or PuTTY in Windows), but don’t let that put you off! By memorising just a few beginner commands, you’ll find it surprisingly easy to pick up.

WP-CLI allows users to manage all aspects of a WordPress site, including basic operations such as updating/installing plugins or themes. You can also do more advanced operations like changing plugin settings, exporting/importing databases, running a search and replace, or automatically creating posts or pages with placeholder content. If you work with WordPress sites, this is definitely one tool you will benefit greatly from having in your knowledge base. Plus, as you get more advanced with this tool, you can further extend your skills and use WP-CLI to manage and roll out all kinds of changes across multiple WordPress websites at once.

This is part 1 of a 2 part series. In this first post, we will cover how you can get started with WP-CLI, including the installation and basic command usage. In part 2, we will cover some of the more advanced operations you can perform. In both cases, this guide is intended for intermediate users who have a fairly thorough understanding of how WordPress works, and are ready to ramp it up to the next level.

Read on below to get started!


Please note that WP-CLI requires SSH access to your hosting account. Please refer to our support centre guide for enabling SSH access if you do not already have SSH access.

Some hosts will have WP-CLI already installed and enabled by default at the server level – but if not, you can follow the below steps to install it on your hosting account. To begin, you will need to log in to your server with SSH. Once you are logged in, please follow the below steps. For your reference, also has the most up to date installation instructions.

1 ) Download WP-CLI using curl.

This will download the latest version of WP-CLI to your hosting service.

curl -O

2 ) Run the file to verify that it’s working as expected. If it is, you will see some information displayed about your hosting environment.

php wp-cli.phar –info

3) Make the command ‘wp’ executable from anywhere, without specifying the full ‘wp-cli.phar’ file. This step is optional, however, it makes running commands a lot faster and easier instead of typing out the full path to the wp-cli.phar executable.

Make the file executable:

chmod +x wp-cli.phar

The following steps will depend on if you have root server access, or standard shared hosting access to your hosting service. If you have root access, move WP-CLI to somewhere in your path:

mv wp-cli.phar /usr/local/bin/wp

Once this is completed, you can skip to step 4 to verify that WP-CLI has been installed correctly.

If you are on shared hosting and don’t have permissions to access /usr/local/bin, you can create an alias instead using the following instructions:

nano ~/.bashrc

Add a new line at the bottom of the .bashrc file, as follows. Replace your /path/to/wp-cli.phar with the actual path to your file:

alias wp=”/path/to/wp-cli.phar”

Hit ‘CTRL +X’, then ‘Y’ and enter to save. Once that’s done, you can either close your SSH session and restart it to apply your changes or run:

source ~/.bashrc

4) To verify that you have installed WP-CLI correctly, please run:

wp –info

Basic Usage

Now that WP-CLI has been installed successfully, we will continue on with some basic usage to help you become familiar with some of the commands at your disposal.

1 ) Listing the available commands

The command that you will likely use the most is the help command. You can list the basic commands that you can use with:

wp help

You can also find a full list of commands on the WP-CLI website.

  1. Installing WordPress

Rather than installing WordPress via FTP, it’s often a timesaver to install it via WP-CLI. To install WordPress, follow these steps.

Download WordPress files:

wp core download

Create your wp-config.php file. You should have already created your database and assigned a user in cPanel.

wp core config –dbname=yourdbname –dbuser=yourdbuser –dbpass=yourdbpass –dbhost=localhost –dbprefix=wp_

Install WordPress using your specified wp-config.php:

wp core install – –title=”My WordPress Website” –admin_user=admin_user –admin_password=yourpassword –admin_email=”[email protected]

WordPress is now installed!

  1. Updating WordPress

Find your current WordPress version:

wp core version

Now, time to update. Running the following command will retrieve and update to the latest WordPress version.

wp core update

  1. Managing plugins

The following command will list all installed plugins, their versions, and their activation status.

wp plugin status

The following command will update all plugins. ‘–all’ can also be substituted with a specific plugin name to only update that one plugin.

wp plugin update –all

This command will search the WordPress plugin repository. Simply replace ‘search term’ with the plugin name.

wp plugin search “search term”

In the following command, replace ‘plugin’ with the plugin name. The –activate flag immediately activates the plugin once it has been installed.

wp plugin install ‘plugin’ –activate

Uninstall a plugin:

wp plugin uninstall ‘plugin’

All of the above plugin commands also apply to WordPress themes. Simply replace the word ‘plugin’ with ‘theme’.

This concludes our article on how to get started with WP-CLI. This is just the tip of the iceberg of what’s possible with the power of WP-CLI! In our next post, we will cover a few more advanced operations, including some that you would typically need a plugin to achieve.

As always, if you have any questions about this post or our shared hostingVPSreseller or dedicated server plans, simply call us on 1300 MY HOST (694 678) during business hours, or submit a ticket through our Support Portal and one of the crew will be in touch!

Get tips & insights
direct to your inbox.

Sign up to our newsletter to get the most from your website hosting with insider tips, tools and guides plus 10% off your first invoice!

Have more questions
on Hosting?

Simply call us on 1300 MY HOST (694 678) during business hours, or submit a ticket through OnePanel and one of the crew will be in touch!

Get in touch