How to safe update WordPress by using preventive measures
Quick summary: Each year you have 2 or 3 new major WordPress versions. They bring new features, bug corrections, safety updates. That’s what makes this content management system (CMS) an awesome tool for Internet projects. By default, the upgrade process is easy. You click on a button, wait for the software to run, and in some seconds […]
Each year you have 2 or 3 new major WordPress versions. They bring new features, bug corrections, safety updates. That’s what makes this content management system (CMS) an awesome tool for Internet projects.
By default, the upgrade process is easy. You click on a button, wait for the software to run, and in some seconds it’s ready again for you to play or work. Or both, at the same time.
The problem is when things go wrong. It can be messy.
I know that for a fact.
Some years ago I was updating WordPress on a site, and something happened.
I put my detective hat on, went to get the magnifying lens and start searching. The files were there. The problem was the database. Some tables got wings and disappeared.
It’s 2008. On those days, updating WordPress was a little messier than it’s today.
These are my first days with WordPress. The site has only two months, and I had no backups.
The hosting backups? Nope.
It was a crappy hosting but and I moved to another sometime after.
At that moment, the solution was to build it up again.
I learned from this ‘case-study.’
With the years I started to build a system to update WordPress in an easy and practical way.
Most important: I set up some preventive tasks that I’ve been using with success to make updating WordPress a peace of mind process.
Let’s dive in.
Backup you site regularly and always before updates
You saw this one coming, right? It’s the most obvious one.
Backups are a ‘must do’ in every online project. According to you site needs, set up a backup system to do it whenever you need. But don’t forget to do it before any update: WordPress, theme, plugins.
You’ll not have problems finding a backup solution suitable for you. You can use your server infrastructure, make use of WP-CLI, plugins or do it manually.
Oh, please, save your backups in more than one place and remotely and do a test run once in a while. Just to check if your backups are working.
Test plugin updates
Plugins are a usual source of update conflict. For preventing those, you can use WP Safe Updates.
It’s a plugin that lets you test plugin updates in a ‘sandbox’ environment. That way, you can check if there’s any problem with it at the moment of truth.
WP Safe Updates adds a Test Update button that appears when a plugin update is available. Clicking on it allows you to preview the changes the plugin makes.
However, you’ll have to edit your wp-config.php file and upload a file to the wp-content directory. The instructions are provided in the Installation section of the plugin’s WordPress.org Plugin Directory page.
Another possibility is WP Staging. It´s a plugin that “creates a file clone of your website into a subfolder of your current WordPress installation with an entire copy of your database.” You can use this clone to test any updates.
Oh, do one plugin update at a time. You might have 2, 3, 4 or more to update and it’s tempting to make it to all at the same time.
Don’t do it. Even if you’ve made the previous test and all went well.
WordPress enables you to do this, but it’s still better to update them individually.
Check theme, plugin, and WordPress core changelogs
I know that read changelog is painful. But can also save you a lot of troubles.
There was one time I saved myself a lot of time just for checking the changelog of a theme.
So, before hit the update button, read the changes made by the developers. Search for potential conflicts, analyze the files that might interfere with your customizations or your setup.
The changes to core or plugins in the directory can be found on their dedicated page. The same for free themes in the directory.
For premium themes or plugins you have to check with their developer team.
Use a test ou staging site for test updates
Another best practice: test everything in a test or staging site. When you’re OK with the changes, you can do them on the live one.
You can use local environment tools to have a clone of your live site on your computer or a staging site if your host has that feature.
Anyway, if your host doesn’t provide it, maybe it’s time to choose a better plan or change host.
When things go south
In a case of compatibility issues or errors, the first step can be revert to a previous version of a theme or plugin.
WP Rollback is a great plugin that can save you from big problems.
The plugin lets you choose from a list of all available versions.
Yes, you have to update WordPress, theme, and plugins whenever there is a new version.
But you have to be wise with that.
Follow some rules to ensure that WordPress updates work smoothly.
Don’t forget to:
Backup your site;
Test plugin updates with WP Safe Updates;
Use WP Staging;
Never test updates on a production site.
When possible, schedule the update for a time when your site is running slow on visitors.
It’s true that all time take some time. But can save you lots of time in the future, money, and headaches.
Remember that you can always make more money. But you can’t make more time