What is WP-CLI and what can it do for you?

Connect on Social

So what is WP-CLI?

WP-CLI or the WordPress Command Line Interface is a PHP based tool that allows you to manage your WordPress site via SSH (Secure Shell) interface.

In simpler terms, it is the back-door to your website. WP-Admin is the GUI or Graphical User interface gives you something nice to look at, with buttons and colours that can be accessed via a web page. WP-CLI drops the GUI and works with simple commands, providing more control and speed.

Why should you use WP-CLI?

This will depend on whether you manage one site or multiple sites but there is always benefit to using WP-CLI. When I am doing regular maintenance on a site or inspecting a client site for the first time there are several commands I always run.

Fundamentals of a WP-CLI command

wp <command> <subcommand> –<option-with-value>=<option-value> –<option-without-value>

WP-CLI install page has details on how to add tab completions so you just hit tab and get a list of available commands, sub-commands and options. https://wp-cli.org 

Let’s dig deeper and see what we can do!

Managing Users.

Database management

Also a number of maintenance tools for DB as well but be very careful running them. Best rule if you are not sure, don’t run them.


Building and Scaffolding Sites

Here are some more detailed commands for building and setting up your sites. You will need a database in place before you begin.

Advanced commands and Piping

Here a some more advanced commands that you can use for testing and fault finding. I would highly advise you don’t use these on a production server as they will change your site and possibly prevent it from being accessed via a web page.

These commands are for development & staging environments only and make sure you do a wp db export database-name.sql first as insurance.

That is only a small sample of commands for WP-CLI. Here are some links for beginners and advanced users as well as a few posts on how to install WP-CLI on your host.


Home of WP_CLI – https://wp-cli.org/

Beginners Guide to WP-CLI

WP-CLI Tips by John Blackbourn (Creator of Query-Monitor)

WP-CLI – Advanced WordPress Management

Other External Resources

Installing on Shared Host

About Mr Wilde

Technology has been in my blood for as long as I can remember. Started with Dick Smith kits when I was 10, I was making FM wireless bugs in high school. After several years working, Electronics Technician, Sound and Lighting Technical Director and then IT Sysadmin, I am going with the flow and leaving the hardware behind, mostly. I am now developing solutions for the cloud, focus on WordPress, SharePoint and Mobile devices. Learning more and more every day.

Leave a Reply

Your email address will not be published. Required fields are marked *