The correct way to update a WordPress website

The correct way to update a WordPress website

Posted on Categories Development, How To, Security

Keeping your website up-to-date should be done regularly and part of keeping your website safe and secure, especially if you collect personal data and want to stay as compliant as possible with the latest GDPR act.

So in this article I wanted to share the correct way to update your WordPress website. Many times in the past I have backed up and tried to update a WordPress website only to find that either due to network issues, timeout, incompatible plugins or other faults that I got a WordPress white screen of death, or the more infamous “Briefly unavailable for scheduled maintenance. Check back in a minute“. Check out our article on how to rescue a WordPress website when it fails.

Usually in the past I found that most issues occur because I updates 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 update even begins is to back up all your files and databases. Most hosting companies now have a control panel and they should hopefully have 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 might 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)

    Folder structure shows you can sort by name if you use Y-m-d format - ©2018 Eggbox Designs Ltd, Website Development Company Portsmouth UK
    Folder structure shows you can sort by name if you use Y-m-d format
  • If you have not done so create an ftp account on your control panel, remember to tie it in 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

    Create an ftp account that chains into your document root - ©2018 Eggbox Designs Ltd, Website Development Company Portsmouth UK
    Create an ftp account that chains into your document root
  • Once you have downloaded you files you can back up the database. If you do not have a backup wizard on your control panel, one easy way is to click the link that goes onto phpMyAdmin from the control panel, click the database and press the export tab, export to an sql file. (If not available you may need to ask your host to do this or install phpMyAdmin, alternatively there are WordPress plugins that do a backup). An SQL file will download which can be easily uploaded again if things go wrong.
    Exporting a database via phpMyAdmin - ©2018 Eggbox Designs Ltd, Website Development Company Portsmouth UK
    Exporting a database via phpMyAdmin

    Once this has been done you will now have a complete backup of your website. Now it is time to log onto your website wp-admin and do your updates.

Switch debugging on before doing the upgrade

You don’t always have to but if your WordPress website has not been updated in 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)

Ok so logging into wp-admin and going to the updates menu dashboard > updates you’ll often see the nice 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.

Do not just update WordPress straight away, make sure you have run the back ups first, then update your plugins, themes and translations - ©2018 Eggbox Designs Ltd, Website Development Company Portsmouth UK
Do not just update WordPress straight away, make sure you have run the back ups first, then update your plugins, themes and translations

The reason we update our plugins, themes and translations before the WordPress core is becasue if you have a plugin that is not compatible with the new version of WordPress you may bomb the site out, and while you may have updated the WordPress core functionality, sometimes (not very often I might add) a plugin may contain a reference to a function, variable or class that may have changed or no longer exist 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 sometimes rarley occurs that if a plugin has very few releases and/or updates it could be the other way around and thenyou would have to go through the process of restoring an erlier 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+ deprecited realated issues including any plugins still using the same funciton 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 if not that bothered 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 or just a few 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.

Update your plugins first - ©2018 Eggbox Designs Website Development company in Portsmouth UK
Update your plugins first, and one or a few at a time

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.

Debugging in WordPress - this shot shows all the available definitions - ©2018 Eggbox Designs Website Development company in Portsmouth UK
Debugging in WordPress – this shot shows all the available definitions – ©2018 Eggbox Designs Website Development company in Portsmouth UK

This may give you more information as to why a plugin or theme cannot be updated and you can then approach the developers support armed with this information. If no support is available from the theme or plugin developers then you might have to try to fix it yourself, or get a developer to try and fix it for you.

Failing everything above and very rarely, you might have to stick with the old version of that plugin or theme until a patch is released.

When all is said and done move onto the next stage of the update.

Update Themes

The same principle applies here. Update the themes to the latest versions of those. 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.

Update Translations

Now you should see the update translations button.

Run this – I have yet to see translations update crash a website, but there is always a first time.

If another set of updates for plugins or themes repeat the process above

Update WordPress

Finally once all is done its time to run the WordPress updates.

If you follow this method then you should hopefully have an updated website :o)

WordPress is now up to date - ©2018 Eggbox Designs Website Development company in Portsmouth UK
WordPress is now up to date

Other Resources

The Official WordPress Updates Guide

 

Leave a Reply

Your email address will not be published. Required fields are marked *