Regularly checking to make sure your website is up-to-date is a crucial part of keeping it safe and secure, especially if you collect personal data and want to stay as compliant as possible with the latest GDPR act.
In this article I want to share the correct way to update your WordPress website, in accordance with my previous point. Many times I have backed up and tried to update a WordPress website only to find that due to network issues such as timeout or incompatible plugins I got a WordPress white screen of death, or the more infamous “Briefly unavailable for scheduled maintenance. Check back in a minute” message. Check out our article on how to rescue a WordPress website when it fails.
Usually I found that most issues occur because I updated WordPress before the plugins, which is why I figured out a more strategic practice that yields greater success and less chance of website whiteout.
Backup your site files and database.
Anybody would insist that the first, most practical step before an update even begins is to back up all your files and databases. Most hosting companies now have a control panel, along with some sort of back up wizard that will do this for you. If you don’t have this facility you can do it the old fashioned way, albeit much slower.
Here is how we do this via FTP
- Create a new local folder on your local machine/computer. I find that the year-month-day format makes a good folder name and can be sorted alphanumerically, for example the format could be: Y-m-d-mywebsite.com (2018-05-19-www.mywebste.co.uk)
- If you have not done so, create an FTP account on your control panel. Remember to tie it to the document root, htdocs or public_html folder, most cpanel FTP account creating will try to create a new directory and chain the new FTP user to that directory, but we are creating an account to download all the files to that local we just created.
- Once you have downloaded your files you can back up the database. If you do not have a backup wizard on your control panel then click the link that goes onto phpMyAdmin, click the database and press the export tab, export to an SQL file. (If unavailable you may need to ask your host to do this or install phpMyAdmin, alternatively there are WordPress plugins that create a backup). An SQL file will download which can be easily uploaded again if things go wrong.
Once this has been done you will now have a complete backup of your website. Time to log onto your website wp-admin and do your updates.
Switch debugging on before upgrading.
You don’t always have to, but if your WordPress website has not been updated for a while you could switch debugging on in WordPress and log any warnings or errors which may prove useful.
To do this you amend this line in the wp-config.php file in the home directory.
define('WP_DEBUG', true); // Turn debugging ON
Update plugins (One or just a few at a time).
By logging into wp-admin and going to the updates menu dashboard > updates you’ll often see a blue button that says “Update Now” – DO NOT press this button straight away!
Below this button may be listed plugins and themes, followed lastly by translations that need updating, these need updating before the WordPress core.
The reason we update our plugins, themes and translations BEFORE the WordPress core is if you have a plugin that is not compatible with the new version of WordPress you may bomb the site out. While you may have updated the WordPress core functionality, a plugin may occasionally contain a reference to a function, variable or class that may have changed or no longer exists in the WordPress core files. This may cause the site to erroneously crash because the plugin can no longer locate the old function.
Albeit it rarely occurs that if a plugin has very few releases and/or updates it could be the other way around, then you would have to go through the process of restoring an earlier version of that plugin.
One that caused sites to have warnings a while back was a warning because PHP being upgraded to version 5.6+ then gave a warning about PHP version 7+ deprecated related issues including any plugins still using the same function names as their constructors. Many of these plugins were fixed over time, but if you are thinking of upgrading to PHP7+ do check it on a stand alone version of your site or you can switch versions in your hosting control panel and if your site crashes go back down to PHP 5.6+.
Update your plugins first and do them one at a time. If a plugin causes the site to crash you can quickly jump back onto your FTP program, delete the offending plugin and re-upload the older version you backed up.
If you still have problems, you can always check the debug.log file under the wp-content folder if you already switched debugging on in the wp-config file.
This may give you more information as to why a plugin or theme cannot be updated, you can then approach the developers support with this information. If no support is available from the theme or plugin developers then you may have to try to fix it yourself, or get a developer to fix it for you.
In the case of failing everything above, you might have to stick with the old version of that plugin or theme until a patch is released.
When all of the above is done move onto the next stage of the update.
The same principle applies here. Update the themes to the latest versions. If you customised your WordPress website already, hopefully you will have used a child theme so that your lovely bespoke design won’t get messed up.
Again, if you run into trouble, you can always remove that theme using the FTP program and re-upload it.
Now you should see the update translations button.
Run this – I have yet to see a translations update crash a website, but there is always a first time.
If there is another set of updates for plugins or themes repeat the process above.
Finally, it is time to run the WordPress updates.
If you follow this method then you should hopefully have an updated website.