Managing WordPress from CLI
As a System Administrator, I prefer things to be super simple and preferably from a command line (CLI). After working with WordPress enough, I became extremely dissatisfied with the update process and the fact I would have to go somewhere and curl/wget a file down, put it in place, manually remove the old one, and go through the tedious task of updating. If this was Docker, I would simply re-build an image…but even then, I have to download and update plugins – honestly, its nasty and a waste of time. This is where WP-CLI comes into play. WP-CLI is a command line tool (packaged with .phar) that I would recommend, and argue is essential to administrating WordPress. Here is an example of the code I ran to completely update my WordPress from some ancient version:
$ wp --path=/path/to/jbkc85.com core update Updating to version 4.4 (en_US)... Downloading update from https://downloads.wordpress.org/release/wordpress-4.4-new-bundled.zip... Unpacking the update... Success: WordPress updated successfully. $ wp --path=/path/to/jbkc85.com plugin update --all ... Disabling Maintenance mode... Success: Translations updates are not needed for the 'English (US)' locale. Success: Updated 3/3 plugins. $ wp --path=/path/to/jbkc85.com theme update --all Enabling Maintenance mode... ... Disabling Maintenance mode... Success: Translations updates are not needed for the 'English (US)' locale. Success: Updated 7/7 themes.
Notice how I had three commands, and it updated multiple areas of my site? This is what System Administration is all about…find tools to make the job simple so you can work on other important matters. With this tool not only am I able to keep my sites up-to-date, but I am also able to make a rather interesting Docker distribution for WordPress and building images with brand-new and up-to-date plugins/themes each build (more on this later). I highly encourage ANYONE running a WordPress site to check this out and start using it!