Updating WordPress Core at Scale

Phil Price

Save time updating WordPress Core with automation

As a web firm operating in 2018, we build and host plenty of websites based on WordPress. How can we not? With such a vast plugin library, quality theme framework (Timber), pre-existing market familiarity, and endless support documentation available online, WordPress often emerges as the smartest platform for building new websites. When using WordPress, however, one must keep up with updates. Each year, many versions of the WordPress core are released to fix bugs, add features, and seal vulnerabilities. Skipping these updates can leave the door wide open for trouble. So, just how do we keep all of our 60+ WordPress websites up to date, safely and efficiently? Read on to find out.

Can’t WordPress update itself?

Technically, yes, but it’s too risky. While WordPress can be configured to keep its own core updated, it does not leverage any sort of test environment or safe-guarded process should something go awry. In order to ensure that our client websites don’t ever miss a beat, we use a workflow that leverages multiple environments for updating and testing before anything is pushed to the live website.

The right tools for the job

One of the benefits of hosting our WordPress sites at Pantheon is that our development team has a robust set of tools and workflows available to them. If you’ve heard of Pantheon, you may already know that they are a hosting platform that provides cutting-edge tools for managing WordPress and Drupal sites like a pro. What you may not know is that nearly every bit of functionality in their world can be invoked via a command line interface (CLI) called Terminus. Thanks to this scriptable interface, we can avoid assigning repetitive update tasks to our staff and instead craft automated scripts that perform the updates for us.

While Terminus runs updates and deploys changes through environments like a wizard, we still need a way to test and verify that our updates don’t impact the site’s appearance before updates are pushed to live. To perform this testing, we use PhantomJS (a headless CLI browser) to grab & compare screenshots.

Note: PhantomJS is no longer a maintained project & we plan on supplanting it in the near future.

Our update automation

Our automation is kicked off every night by a server in our network. It uses Terminus to grab a list of websites, checks each for available core updates, and applies them in the “development” environment. It then pushes the updated code from “development” to “test” and pulls content and files from “live” to “test.” This gives us a perfect situation to perform testing in, as both “test” and “live” will have the exact same content, but only “test” will have the updates applied. The script then invokes PhantomJS to grab screenshots of both “test” and “live” and compares them for pixel-accurate visual parity. If no discrepancies are found between the two versions of the site, the script considers the update okay to go live and makes a final code push from test to live. However, if any discrepancies are discovered, it will pause the process and send us a notification, so that we can take a closer look.

How much time does our automation save?

We know that our automation must be saving time, but how much time does it really? In 2017, there were 11 major and minor maintenance releases of WordPress (this excludes “release candidate” releases). We maintain 60+ websites, and it would take about 20 minutes to perform a safe and proper update using our agency workflow. If we add all that time up, we could have spent 223 human resource hours updating our client WordPress websites, just in 2017 alone. Instead, we spent about 30 minutes checking over the results of each of the 11 updates – or about 6 hours total. This means we saved well over 200 human resource hours last year – and that’s a lot of time! I mean, 200 hours is enough to complete a brand new website including meetings, design, development, content, and all.

Final thoughts

If you’re responsible for updating a large number of WordPress sites at once, automation and smart tools are your best friends. If you have a WordPress website that updates itself without any sort of staging or test step, proceed with caution and definitely consider stepping up your process. I love Pantheon fiercely as it fits our agency needs like a glove, but there are plenty of tools you can use and ways you can approach an automated WordPress mass-update. Just be sure to choose your tools and develop your automations with great care, have backup measures in place in case anything goes off, and enjoy finding other ways to invest the time you will save.