WP-CLI

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.

Requirements

  • UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment
  • PHP 5.3.2 or later
  • WordPress 3.5.2 or later

Installation

Download wp-cli.phar:

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

Then, check if it works:

php wp-cli.phar --info

Make wp-cli.phar executable and move it in our PATH.

chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Usage

Go into a WordPress root folder and type wp

List of available commands:

  • cache - manage the object cache.
  • cap - manage user capabilities.
  • cli - get information about wp-cli itself.
  • comment - manage comments.
  • core - download, install, update and otherwise manage wordpress proper.
  • cron - manage wp-cron events and schedules.
  • db - perform basic database operations.
  • eval - execute arbitrary php code after loading wordpress.
  • eval-file - load and execute a php file after loading wordpress.
  • export - export content to a wxr file.
  • help - get help on a certain command.
  • import - import content from a wxr file.
  • media - manage attachments.
  • menu - list, create, assign, and delete menus
  • network
  • option - manage options.
  • plugin - manage plugins.
  • post - manage posts.
  • rewrite - manage rewrite rules.
  • role - manage user roles.
  • scaffold - generate code for post types, taxonomies, etc.
  • search-replace - search/replace strings in the database.
  • shell - interactive php console.
  • sidebar - manage sidebars.
  • site - perform site-wide operations.
  • super-admin - list, add, and remove super admins from a network.
  • term - manage terms.
  • theme - manage themes.
  • transient - manage transients.
  • user - manage users.
  • widget - manage sidebar widgets.

SOURCE