Gatsby Default Starter

Amazing travel with WP-CLI

Written on June 28, 2019

WP-CLI is a great tools for develop and manage WordPress site without hassle.

Install WP-CLI

Before drive a bus, first need driving license. So, to use WP-CLI, install it in computer. I am using it on Ubuntu 16.04 operating system. LAMP stack and default terminal will fit for this. Open old, fat, big, black TERMINAL. If computer has already CURL installed, then type

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Otherwise, get this phar file with wget command, which is native. Type

$ wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Anyway, I get wp-cli.phar file. This, PHAR file will executable with chmod +x command. So, this command will be
$ chmod +x wp-cli.phar
then, move wp-cli.phar file to /usr/local/bin/wp directory, used this command
$ sudo mv wp-cli.phar /usr/local/bin/wp
I have WP-CLI. To check, command with $ wp --info, and it will show the whole bunch of information about WP-CLI.

So, Concluding in installation step, 4 commands require to install WP-CLI (with checking command)
Command 1: $ wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Command 2: $ chmod +x wp-cli.phar
Command 3: $ sudo mv wp-cli.phar /usr/local/bin/wp
Additional Command 4: $ wp --info

For windows, here is the instruction.

Install WordPress

Step 1: Open target directory in the terminal. To download the latest copy of WordPress, type command
$ wp core download
Here are options if we need to select where will it install, which version will install and 3 other options.
Step 2: After download the core files of WordPress, we need to configure it. Need to create wp-config.php with our new database name, user and password.

$ wp config create --dbname=wpcli --dbuser=root --dbpass=root

Step 3: We need to create a new database wpcli.

$ wp db create

Step 4: Install WordPress

$ wp core install --url=localhost/wpcli --title="WP-CLI" --admin_user=admin --admin_password=12345 --admin_email=test@localhost.com

Next, we will see how to

  • Manage WordPress ecosystem
  • Backup WordPress Database
  • Plugin scaffolding
  • Theme scaffolding