WordPress accounts for almost 20% of all websites on the internet. And if you’re a developer these days, you probably build on the WordPress framework. And if you haven’t heard about the WP-CLI, it’s about time you learn about this fantastic tool and how it can make managing WordPress websites easier and faster.
What Is WP-CLI
WP-CLI is a command line interface for WordPress that allows developers to accomplish difficult or time-consuming tasks using the graphic WordPress interface. Like most dev elements, its primary function is to give your productivity a boost and speed up the process of developing a website to completion. Unfortunately, however, WP-CLI doesn’t come with a comprehensive user manual, and it can be pretty confusing for those who might not already be familiar with working on command lines.
Top Command Line Tricks
WP-CLI can be used to manage, update, and even troubleshoot installations of WordPress. And since it can take some amount of time to switch between traditional WordPress editing to the command line, it’s most helpful to know exactly what you want to do to before you dig in. With that in mind, we’re going to cover some of the most helpful tricks that WP-CLI can be used to do for you.
Installing WordPress
You can install WordPress in about 5 minutes uploading a file or using other hosting management tools. But you can run roughly four lines of code in WP-CLI which can install WordPress for you in any directory in less time. If you install a lot of instances of WordPress as a day-to-day activity, this can save a lot of time that adds up. If you use a lot of the same credentials for all configurations, you can even establish these as default settings for all your installations.
Adding Themes and Plugins
Do you use a standard suite of themes or plugins on your WordPress builds? It’s very simple to add themes or plugins standard in the WordPress database to any WordPress installation. It just takes a one-line code to run; and you can even add a tag to activate these plugins after installation at its end. Since hunting down plugins individually on the graphic WordPress admin interface can take quite some time, this is a fantastic time-saver even if you don’t use WP-CLI to install WordPress. And you can simply copy the code you write for this once, to be re-used on all future WordPress installations.
Upgrading WordPress Themes and Plugins
It’s just as easy to install updates as the themes and plugins themselves. In fact, in a single line, ‘$ wp plugin update –all’ you can update all of your plugins. The same logic applies to themes, and updating the WordPress core.
Upload Images in Bulk
WP-CLI also allows you to do something magical: upload images in bulk. If you’re using the traditional WordPress admin area to upload photos, doing so can be an absolute pain. And if you don’t feel comfortable uploading folders of photos into the directory of your WordPress, it’s a one-line snap to upload images in bulk to your WordPress installation.
Setting Up Child Themes
Love using child themes? That’s another simple task that WP-CLI can do for you! And if you like, you can set up and activate the same child theme for all your WordPress installations. Even if you’ve custom-made a child theme, you can use Sass to upload your own custom theme as you like.
The Bottom Line
WP-CLI is a great tool for saving time developing websites with WordPress. Though you’ll get the most value out of all of its capabilities if you build many WordPress installations regularly, even if you do most of your developing on a single WordPress framework, it can still come in handy to save time and improve your productivity moving forward. From creating custom taxonomies to installing updates in bulk, it can shave hours off of your workload.