Control Maintenance Mode

As of WP-CLI v2.2.0, you can now control the maintenance mode on your WordPress site. Example:

wp maintenance-mode activate
wp maintenance-mode deactivate
wp maintenance-mode status

Indexing Data with Elasticsearch

Elasticsearch is an open-source full-text search engine. It is used to index data and search that data incredibly quickly. We offer this as an add-on for Host SEO clients. You can use ElasticPress WP-CLI commands to perform indexing over SSH. Example:

wp elasticpress index [--setup] [--network-wide] [--posts-per-page] [--nobulk] [--offset] [--show-bulk-errors] [--post-type]

Working with Multilingual Sites

WP-CLI v2.0.0 includes a new family of commands wp i18n for those of you working with multilingual sites. For example, you can create a POT file for a WordPress plugin or theme.

wp i18n make-pot <source> [<destination>] [--slug=<slug>] [--domain=<domain>] [--ignore-domain] [--merge[=<file>]] [--exclude=<paths>] [--skip-js]

See i18n-command documentation.

Using WP-CLI with WooCommerce

Working with eCommerce sites? ? We recommend checking Robot Ninja’s amazing WP-CLI WooCommerce development guide for quick and easy commands you can use. Generating a list of customers, orders, and even creating bulk products are all possible with WP-CLI.

Using WP-CLI Remotely

One of the best things that you can do with WP-CLI is manage your remote WordPress installations. This is truly a website manager’s dream come true.

To seamlessly run WP-CLI commands on a remote server via SSH you previously needed the wp-cli-ssh addon command. But as of v0.24.0, this is now part of WP-CLI itself! ?

Important: You need WP-CLI installed both on the computer you’re running the command from and your server.

Configuring Remote Servers

You can configure your servers globally or locally. To configure them globally use the config.yml file. You can also use the wp-cli.yml or wp-cli.local.yml files in your current working directory.

The configuration of servers works something like this, paste this in one of the mentioned files:


    cmd: ssh %pseudotty% %cmd%
    path: /www/path/to/site/root

Once all this is done you can type the following command to update WordPress on your remote site:

wp ssh core update --host=staging

If you own or manage a lot of sites, I think you can see that this is amazing! The script will ask for a password, but if you use RSA keys to log in you can forgo that as well. Take a look at this article to set that up.

Using Bash Scripts

Bash scripts save you even more time by automating tasks. Remember how we needed to type a lot of commands to install WordPress? You can do that with a single bash script. Inside a directory create an file. Paste the same code we had before inside and save it.

wp core download
wp core config --dbname=mydbname --dbuser=mydbuser --dbpass=mydbpass --dbhost=localhost --dbprefix=whebfubwef_ --extra-php <<PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
wp db create
wp core install --url= --title=SiteTitle --admin_user=username --admin_password=mypassword

All you need to do now is type bash and everything will be done for you, without user intervention. If you manage a lot of sites you can set up all your environments and create a bash script like this:

wp ssh core update --host=clientA
wp ssh core update --host=clientB
wp ssh core update --host=clientC
wp ssh core update --host=clientD

When a new WordPress version comes out, this could save you a lot of time! Since you can do anything you like with WP-CLI you can even update themes and plugins regularly on a number of client sites at once.


WP-CLI really is the developer and website manager’s dream come true. As developers we can create test sites in a jiffy, add test content and do all sorts of import/export magic. Site managers can handle site updates and other tasks for multiple sites with single commands. Make sure to check out the WP-CLI v2 release notes!

If you haven’t already tried WP-CLI I urge you to give it a go. There are also a bunch of community commands like WP-CLI-SSH which add even more great features! If you’re running into problems, make sure to check out the WP-CLI common issues documentation.

Don’t forget that Host SEO’s Google Cloud-based architecture supports WP-CLI out of the box. If you’d like to try the most modern WordPress hosting architecture and have access to great tools like WP-CLI, try our managed WordPress hosting.