WP-CLI Guide

What is WP-CLI?

WP-CLI is a command line tool for developers to manage common tasks (and not so common) of a WordPress installation. It can add/remove users, posts, categories, insert test data, search and replace in the database, reset passwords, help troubleshoot performance issues, and much more!

The WordPress GUI is pretty, but sometimes you don’t want to leave the command line. And now you don’t have to.

If you’re looking to execute simple WordPress tasks in the most efficient manner possible, then you need WP-CLI on your side.

WP-CLI Commands:

If you are used to working in the terminal there’s nothing special about WP-CLI for you. Commands always start with wp followed by a command and subcommand, followed by required and optional parameters, something like this:

wp command subcommand requiredparam --optionalparam --optionalparam2=value

Let’s install a theme to see how this works with a real command:

wp theme install twentyseventeen --activate

This will install and activate the Twenty Seventeen theme on your WordPress installation.

Note that WP-CLI will work with the WordPress installation you are currently in the terminal. If you switch directories to go to another WordPress installation, it will work with that one.

Here’s a few basic tasks you probably complete on a regular basis. With WP-CLI, they take nothing more than a simple command – check them out:

Example to Setup WordPress on your computer with WP-CLI:

See below list of commands to setup wordpress on your windows pc with WP-CLI

1) Use following command to install wordpress your current directory
wp core download

2) Once you downloaded wordpress, then use below two commands to configure wp-config.php and create database
wp core config --dbname=wp_cli --dbuser=root --dbpass= --dbhost=localhost --dbprefix=wp_
wp db create

3) Once database and wp-config.php file created, use following command to complete setup process on wordpress
wp core install --path="C:\wamp\www\wp-cli" --url="http://localhost/wp-cli" --title="CLI Blog" --admin_user="umang" --admin_password="umang" --admin_email="umangitdeveloper@gmail.com"

Hope with above commands, your wordpress setup completed.

Support:

WP-CLI’s maintainers and contributors have limited availability to address general support questions. The current version of WP-CLI is the only officially supported version.

When looking for support, please first search for your question in these venues:

Leave a comment