If you are a WordPress developer, there is probably a lot of boring tasks you have to do over and over, like installing WordPress from scratch for testing purpose, outside your usual dev environment.

Every time you’re installing WordPress, you have to download the files, create the wp-config.php file, set your MySQL credentials, etc.

Here is where WP-CLI becomes very handy.

WP-CLI is a set of command-line tools for managing WordPress. You can install wordpress, install plugins, generate posts and much more, without using a web browser.

It is recommended to be familiar with command lines. But if you use git, grunt, or gulp, I guess you already are!


So the first thing to do is install wp-cli on your environment.

The most simple way to do it is to install it with composer (a PHP dependency manager), then add it to your PATH (environment variables)

composer create-project wp-cli/wp-cli --no-dev

For more info about installation, check the wp-cli website.

If it’s installed correctly, you should be able to check the version with

wp --version


Here are some very useful commands that I use very often.

A simple text file that you can modify for each project (set specific plugins and themes) and be able to retrieve your working environment in a few seconds (I mean literally in a few seconds)

You will find all available commands on wp-cli.org.