Using WP-CLI Aliases

WP-CLI aliases, added in the 0.24.0 update, allow you to “talk” to your install. Note this is primarily useful if you are working with an install on a remote server or on a development VM (such as Trellis, VVV, Homestead) where you would normally need to SSH in to perform tasks.

Setting up aliases

You can set up an alias for each of your environments in a wp-cli.yml file. If you’re using a Bedrock setup, wp-cli.yml already resides in your site repo. If you aren’t using Bedrock, you’ll need to create a file named wp-cli.yml in the root of your WordPress directory.

From here, you can define an alias with the title of your choice preceded by the @ symbol. @development and @production would be pretty standard and usable amongst a team.

This follows the format of:

  ssh: user@host/path/to/WordPress

In a Trellis + Bedrock setup, an alias would look something like:


The development alias for this site would be:

  ssh: vagrant@example.test/srv/www/

For a VVV-based development install:

  ssh: vagrant@local.wordpress.test/srv/www/wordpress-default

Example use

$ wp @production plugin activate soil

Help support our open-source development efforts

Help us grow

Join over 7,800+ subscribers on our newsletter to get the latest Roots updates, along with occasional tips on building better WordPress sites.

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?

“Easily the best WordPress email I get.” Colin OBrien

Follow us on Twitter @rootswp

Ready to checkout?