One of the features of WordPress that is great for content developers and web developers is plugins.
In fact, you could argue that it is the backbone of WordPress’s ecosystem. WooCommerce, for example, was acquired by Automattic precisely for its benefits to e-commerce.
What stinks about plugin updates? When they break your user experience.
The standard way to fix this is to re-install the old version via FTP or using version control via GitHub. While these methods are recommended, there is a super-fast alternative: WP-CLI (WordPress Command Line Interface).
Keep in mind, WP-CLI does not work with paid plugins. However, it does work with free plugins listed in the WordPress.org Plugin Directory. WP-CLI can update widely used plugins like JetPack, ACF, Contact Form 7, WP-Cerber, and most SMTP plugins.
Why update your plugins from command line? The updates happen in seconds.
How Does WP-CLI become installed on your Server?
There are a few things you have to do on the back end for WP-CLI to work.
For example, Go Daddy has their own specific instructions for installing WP-CLI.
The first thing you have to do is establish SSH keys.
SSH stands for “secure shell” and is a secure way to log in from a specific computer’s command line into your server or a web host control panel like cPanel. cPanel comes standard with most hosting providers that provide a Linux platform for WordPress.
On a Mac, you can create keys in Terminal and upload them to cPanel.
ssh-keygen -t rsa -C "email@example.com"
You will then be prompted to create a pass phrase.
Pass Phrases are not passwords. They can have spaces.
The file is located at the user .ssh folder on your Mac.
For example: /Users/JS/.ssh/
You will need to navigate to your user name, not “JS”.
You can navigate to that folder in Terminal with this command:
Then, add the user to the keys.
Finally, import the RSA key to your web host.
How Does WP-CLI Update Plugins?
On a Mac, this is reasonably straightforward. Login to your Terminal and you will be able to access your cPanel folders directly.
Navigate to your public html files (where WordPress is stored).
Then you can run these commands.
wp plugin list
Then, you can update the plugin by running this command.
wp plugin update (name of plugin)
wp plugin update jetpack
If the JetPack update breaks your site go back to the old version number (which we brought up with the wp plugin list command).
wp plugin update jetpack --version=5.9
For a full list of WP-CLI capabilities check out their website.
There are a lot of useful things you can do from the comfort of your Terminal.