If you’ve been to a WordCamp or two, or you have been actively following the WordPress community, the chances are good that you’ve heard of the existence of a thing called “WP CLI.” Maybe that’s all you know. Perhaps you’ve used it. Perhaps you may want to consider using it. Let’s dive in what is WP-CLI and why you probably want it.
Why you need WP-CLI in your life
If there’s one thing developers love, it’s finding ways to speed up and automate tedious, manual grunt work that could just as easily be automated. That’s where the WordPress Command Line (WP-CLI) tool comes in to blast through tasks with just a few keystrokes without disturbing the overall flow. WP-CLI is the developer and website manager’s dream come true. It has a big success in helping overall developer productivity to manage common tasks (and not so common) of WordPress installations that otherwise take a lot of time to execute manually using the GUI. WordPress developers can create test sites in a jiffy, add test content, remove users, posts, categories, insert test data, search and replace in the database, help troubleshoot performance issues, and do all sorts of import/export magic. Site managers can handle plugin and version updates and other tasks for multiple sites with single commands.
Some of the core functions that WP-CLI can be used to complete:
- Start a fresh WordPress website
- Update and install WordPress themes and plugins
- List all plugins and their status
- Add, delete, activate, and deactivate multiple plugins
- Update the core WordPress framework
- Upload media files in bulk, avoiding having to do them one at a time
- Create database backups and restore existing databases
- Manage WP-Cron events
- Create or change user accounts and permissions
- Easy search and replace functionality within the database
To see what basic functionality WP-CLI is equipped with, you can check out their complete list of basic commands.
A bit of primer
WP-CLI has been an open source project for over a decade, initially developed by Andreas Creten and Cristi Burcă (better known as Scribu) back in 2011. It is being maintained primarily by Daniel Bachhuber since 2013. The primary goal of WP-CLI is to help speed up WordPress developer’s workflows, maximize time, and boost developer productivity. Over the years the project has emerged into so much more and has steadily gained momentum in the WordPress developer community. As of January 2017, WP-CLI officially moved to WordPress.org and is also now being co-maintained by Alain Schlesser. It was WP-CLI version 1.2.0 that was the second release since the project was brought under the official WordPress umbrella and the first major release since hiring Alain Schlesser as a part-time co-maintainer.
The latest WP-CLI release v2.0.0 that was initially due to be released on July 31st but was later re-scheduled for Wednesday, August 8th. This delay occurred, because it was much more work to disentangle the feature tests to split them up for the restructuring. A couple of weeks later and a bugfix release was in order, as the new
i18n make-pot command was not properly packaged in v2.0.0. Today we greet the new WP-CLI v2.0.1!
We’ve just scratched the surface of what you can do with the WP-CLI. Now, let’s check what the breaking changes with the newest update are.
“Framework” & “Bundle” are now two separate packages
The main difference between WP-CLI 1.5 and WP-CLI v2.0.0, is the structure of the whole tool. With the latest release, the team behind WP-CLI has separated the bundle and the framework into separate packages, meaning that the framework used by most WordPress users and developers is now leaner and faster than ever before. That is a substantial improvement for development and maintenance.
Using WP-CLI through Composer
With the separation of the framework comes other benefits too, mainly the reduced number of annoying dependencies such as the hard requirement on an old Symfony version.
You will not see WP-CLI automatically pull in all bundled commands automatically. With v2.0.0, it will only pull in the lean framework as a dependency, nothing more.
Minimum version of PHP update
The minimum PHP requirement on WP-CLI v2.0.0 has been bumped up to PHP 5.4. This will break for anyone trying to run WP-CLI on PHP 5.3.
FastComet, WP-CLI 2.0.1 release, and you
If you’re a FastComet client, WP-CLI is already installed, configured, and ready to go. We have already updated WP-CLI to version 2.0.1 on all our servers. And FastComet offers SSH and the full spectrum of WP-CLI to help you manage your WordPress installation from the command line. You’ll simply need to ensure your account has SSH activated, and get it set up for use with your local computer.