WP-CLI—A Panacea for WordPress Developers?

The back of an Earthling Interactive employee working on a computer with three monitors

Developers at Earthling Interactive have a front-row seat at the Madison WordPress Meetup. Not only does Earthling Interactive sponsor the pizza each meeting, but the Meetup group was started by Earthlings!

Recently, one of the regular Meetuppers, and Freelance WP developer, Nate Finch, introduced the room to WP-CLI.

From the documentation: WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installs and much more, without using a web browser.

I started to look into WP-CLI beforehand, but decided to wait because my first reaction was, “So what? It’s not hard to update plugins as it is!” During the meeting, I realized that I may never have been happier to be so wrong.

Nate introduced us to the installation instructions, then talked about wp checksum, which can be used to compare the files in the project to the most recent version (core) or a specified version. This is useful if you suspect that your installation might have been hacked and don’t have a repository with which to view a diff. This only checks the core files so it is possible the site is still compromised but it is a good first check. He went on to show how to create any number of new posts with all of the fields normally available in the admin interface.

Fellow Team Lead, Dan Greig says, “that would be great for writing test scripts!”

The next example was a bash script that Nate wrote which takes an array of project folder names and runs theme, plugin, and core updates and then checks the core files and runs a database check. I could almost hear the heavenly choir sound as the Earthlings in the room realized what this could mean for our 25+ managed WP sites when there is a security release.

It was at this point that I was too elated to continue taking notes and I let the calm overtake me as I listened to the rest of the presentation. Needless to say, we will be implementing WP-CLI into our WordPress site maintenance and workflow.