WP-CLI The command line interface for WordPress

A more RESTful WP-CLI

Landing page last updated: August 1, 2016

WP-CLI’s mission is to be, quantitatively, the fastest interface for developers to manage WordPress. “A more RESTful WP-CLI” was a Kickstarter-backed project to unlock the potential of the WordPress REST API at the command line. This funding supported 232.42 hours of Daniel Bachhuber’s time towards making improvements to WP-CLI and the WP REST API. For a full debrief, read the Post Status post about the project.

Wait a second, what does it mean to “unlock the potential of the WP REST API at the command line”? Pragmatically, it means any endpoints registered in plugins or themes are automagically accessible as WP-CLI commands. For instance, if you were to register an endpoint for GET /my-plugin/v1/product/<id>, this endpoint is also accessible on the command line as (more or less) wp @prod product get <id>.

Quick links: Highlights - Milestones - Budget - Supporters


Highlights

RESTful WP-CLI

RESTful WP-CLI is a WP-CLI package that makes WP REST API endpoints available as WP-CLI commands.

As WordPress becomes more of an application framework embedded into the web, RESTful WP-CLI enables WP-CLI users to interact with a given WordPress install through the higher-level, self-expressed abstraction of how WordPress understands itself. For instance, on an eCommerce website, instead of having to know data is stored as wp post list --post_type=edd_product, RESTful WP-CLI exposes the properly-modeled data at wp rest product list.

First, RESTful WP-CLI auto-discovers WP REST API endpoints from any WordPress site running WordPress 4.4 or higher. These can be endpoints from the WP REST API v2 plugin, or custom endpoints you’ve registered yourself. You can target a specific WordPress install with --path=<path>, --ssh=<host>, or --http=<domain>. Then, it registers WP-CLI commands for the resource endpoints it understands, in the wp rest namespace. In addition to the standard list, get, create, update and delete commands, RESTful WP-CLI also registers commands for higher-level operations like edit, generate and diff.

Try it yourself:

wp package install wp-cli/restful
wp --http=runcommand.io rest excerpt list

For a summary of these features, check out wp-cli/restful.

Package management

Just like WordPress has plugins, the future of WP-CLI is packages of commands. For this future, WP-CLI is working to proactively solve the problems WordPress has with plugins:

In this model, WP-CLI becomes the common interface, and supporting application layer, to a rich ecosystem of features. Doing so opens more frontiers for innovation, which leads to a greater selection of ideas to choose from. And because more people are involved in authoring packages, WP-CLI benefits from a larger contributor pool.

As a result of the Kickstarter project, you can install WP-CLI packages from the Package Index with wp package install, read through the commands cookbook for a thorough introduction to creating a WP-CLI command, or use wp scaffold package (repo) for the easiest way to generate the boilerplate for your new WP-CLI package, complete with functional tests.

Documentation portal

In the past, WP-CLI documentation lived in a poorly maintained, hard to search Github Wiki. Now, it’s been reincarnated as a documentation portal on the website.

Most notably:

Since relaunching the documentation portal in March, we’ve also written a new contributing guide, and rewritten the WP-CLI homepage with translations to six languages other than English.


Milestones

Blog posts:

Releases:

Presentations:


Budget

Here’s a breakdown of how the project’s 232.42 total hours have been used (between January 1st and July 20th, 2016):

Activity WP-CLI WP-API
Development 84.38 67.95
Support 10.91 15.39
Documentation 27.21 1.17
Blogging 16.97 0
Meetings 0 7.91
Admin 0.77 0
Total 140.24 (of 140.00 budgeted) 92.42 (of 92.42 budgeted)

Note: time spent fulfilling the Kickstarter rewards is tracked separately.


Supporters

This project is made possible thanks to the backing of many generous organizations and individuals.

Platinum

Pressed offers white-label, fully managed, WordPress hosting, built on Amazon’s cloud infrastructure. Launch your own managed WordPress hosting brand and let us handle all the maintenance, updates, customer support and billing while building a new recurring revenue stream for your business.

Gold

Chris Lema is the CTO & Chief Strategist at Crowd Favorite. He’s also a WordPress evangelist, public speaker & advisor to product companies. Human Made is a leading WordPress Development, Hosting and Consultancy Firm with a global team covering Europe, The USA, and Asia/Australia.
Pagely® is the World’s first and most scalable WordPress Hosting platform: We help the biggest brands scale and secure WordPress. Pantheon is a website management platform used to build, launch, and run awesome Drupal & WordPress websites.

Silver

Individual

Aaron Jorbin, Aki Björklund, Anu Gupta, Bjørn Ensover Johansen, Brian Krogsgard, Bronson Quick, Chuck Reynolds, Corey McKrill, Daniel Hüsken, Dave McDonald, Dave Wardle, Eli Silverman, Felix Arntz, Howard Jacobson, Japh Thomson, Jason Resnick, Jeremy Felt, Justin Kopepasah, Kailey Lampert, Kevin Cristiano, Max Cutler, Mike Little, Mike Waggoner, Nate Wright, Pippin Williamson, Quasel, Ralf Hortt, Richard Aber, Richard Wiggins, Ryan Duff, Scott Kingsley Clark, Shinichi Nishikawa, Sven Hofmann, Takayuki Miyauchi, Tom McFarlin, rtCamp