Using WP-CLI


Browse by products and services

  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 20 minutes
    • Tools Required: SSH access
  • Applies to: WordPress Hosting
    • Difficulty: Medium
    • Time Needed: 20 minutes
    • Tools Required: SSH access

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is not supported by (mt) Media Temple. Please take a moment to review the Statement of Support.

Overview

WP-CLI is an open-source suite of command-line tools for managing and administering WordPress. Most functions that can be done in the WordPress Dashboard via a web browser can be completed by typing a command at a prompt. If you have the Grid hosting platform, WP-CLI is already installed, configured, and ready to go. It can be accessed by typing the WP command once you are connected to your server via an SSH terminal.

Plugin authors may make use of the WP-CLI commands right in their plugin code, but its real extensibility is in the speed of inputting and automating commands rather than manually clicking around a dashboard, and is greatly appreciated by keyboard wizards everywhere.

Instructions

NOTE:

On the GridWordPress Hosting hosting platform, WP-CLI is already installed and ready to go.

    1. First, log into your hosting platform via SSH as the Server Administrator user.
    2. Next, type "wp" and hit enter. You will be presented with a list of sub-commands that can be executed. The format is "wp command some_modifier"
  1. To get more information and sub-commands for a specific command, type wp help command.
    $> wp help core
    
    NAME
    
      wp core
    
    DESCRIPTION
    
      Download, install, update and otherwise manage WordPress proper.
    
    SYNOPSIS
    
      wp core <subcommand>
    
    SUBCOMMANDS
    
      config                 Set up a wp-config.php file.
      download               Download core WordPress files.
      init-tests             Set up the official test suite using the current WordPress instance.
      install                Create the WordPress tables in the database.
      is-installed           Determine if the WordPress tables are installed.
      multisite-convert      Transform a single-site install into a multi-site install.
      multisite-install      Install multisite from scratch.
      update                 Update WordPress.
      update-db              Update the WordPress database.
      version                Display the WordPress version.
    
    
    

More Learning Resources

WP-CLI Official List of Commands:
http://wp-cli.org/commands/

Mike Schroder on WordPress.tv:
http://wordpress.tv/2013/08/06/mike-schroder-magical-wordpress-management-using-wp-cli/

WP CLI For Fun & Profit:
http://wp.tutsplus.com/tutorials/using-wp-cli-for-fun-and-profit/

TreeHouse:
http://blog.teamtreehouse.com/tame-wordpress-from-the-command-line-with-wp-cli

Scribu:
http://scribu.net/wordpress/a-command-line-interface-for-wordpress.html

Commands Cookbook:
https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook

Using WP-CLI in your plugins:
http://www.youtube.com/watch?v=0NsCPPrWvKs&feature=share&t=38m37s

Community Commands:
https://github.com/wp-cli/wp-cli/wiki/List-of-community-commands