WP-CLI Basics

This post is part of a series designed to help developers who are just starting out understand some basics and how they relate to WordPress. This sixth post is about WP-CLI, which stands for WordPress Command Line Interface. If you’ve ever worked with Drupal’s command line tool Drush then it should be easy to learn. If not, you have nothing to fear. We’ll walk you through the basics and provide a video on how to get started hands-on.

WP-CLI is offered on our VPS plans and above (since it requires SSH access), and allows you to administer your WordPress install using shell commands. You can do quite a bit with WP-CLI, including managing posts, comments, media (images & video), plugins, themes, rewrite rules, user roles, and more. It’s a quite powerful little tool. The whole idea and end result is that you no longer have to continually toggle between your browser where WordPress lives and your terminal window to make changes using the command line.

In addition to the commands available, WP-CLI also offers a built in help system which is nice. You can simply use the command wp help to see a list of all the top-level subcommands. Furthermore, you can dive deeper by asking the system for information about specific subcommands. For example, you could type wp help plugin to get information on what you can do in terms of managing them from the command line as well as a list of the specific plugin subcommands. Not enough detail? You can even query about certain aspects such as wp help plugin install to get information about just that.

Normally you’d have to mess with finding the download and installing it to get up and running, but since it’s pre-loaded on our VPS/Enterprise plans, you get to skip that step and can focus your time and energy on the important stuff like learning the commands.

The official site for WP-CLI is located here, and you can find the list of default commands here. You can also check out the list of community written commands here. Finally, here’s a video for the hands-on approach now that you’re familiar with what WP-CLI is and how it can help…

New Posts in your inbox