This is a sneak view of my presentation on the upcoming WordCamp Iloilo.
WP-CLI might sound a bit scary for others that haven't tried to use CLI or heard it before. It is not really scary it is actually fun to use!
You might have been thinking what CLI stands for and what WP means?
CLI stands for Command Line Interface - Wiki says:
A command-line interface (CLI) is a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines). The program which handles the interface is called a command-line interpreter or command-line processor, or shell.
In my own interpretation, CLI is a set of command that is used to manage a site and make less interaction in the browser. It eliminates the number of clicks in the site configuration. The number of clicks can be equivalent to one single WP-CLI command.
Enough for introduction let's get started.
- UNIX-like environment (OS X, Linux, FreeBSD, Cygwin)
- PHP 5.4 or greater
- WordPress 3.7 or greater
Download wp-cli.phar using wget or curl:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Verify if wp-cli.phar is working.
php wp-cli.phar --info
Make wp-cli executable globally.
chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp
To update WP-CLI:
wp cli update
Basic WP-CLI commands
Check WP-CLI version:
Check WordPress version:
wp core version
Flush the object cache:
wp cache flush
Tests the WP Cron spawning system and reports back its status.
wp cron test
wp plugin install <plugin-name>
wp plugin update <plugin-name>
wp plugin activate <plugin-name>
wp plugin deactivate <plugin-name>
wp plugin list
wp user list [--role=administrator,editor]
These are just a few examples of command that you can use in managing your WordPress site, there's a lot of commands out there that you can use. Follow me at WordCamp Iloilo to learn more: https://2019.iloilo.wordcamp.org/speakers/#wcorg-speaker-roald-umandal