Take this scenario:
So you run a self-hosted WordPress site and it’s fundamental to what you do, but each time you log in you see that there are a multitude of updates waiting to be installed. You think of the headache of fixing the issues you had the last time, as well as the lost business through downtime and decide to leave them for another day.
Having been in this very scenario myself in the early days of WordPress, I know what it can be like; but this entire scenario need not be a worry as long as you follow a few simple guidelines before performing your WordPress updates!
Back-up both your database and site files.
While you should really be taking regular backups of your site anyway, a backup taken from the moment before you commence the updates will ensure that if anything goes wrong you have a working version of your site which you can restore to if things don’t go to plan.
It is important that you take a backup of your database, as this contains all of the content stored and managed through your WordPress admin area, such as posts, pages, and settings.
While it is possible to re-create a WordPress site solely from the database backup, A backup of the site files allows you to easily get back up and running with the exact plugin and theme versions including any custom modifications you may have made.
Use a child theme.
Possibly the most common cause of WordPress sites appearing “broken” after an update is because of changes that have been made to the theme files. Commonly this includes adding custom meta tags to the theme’s header files, and adding custom links, scripts, and copyright messages to the theme’s footer files.
Any updates you perform to the theme will over-write the modified files restoring them to there original state. Because of this, all modifications should ideally be created in a Child-Theme; this allows you to maintain a separate copy of the files which you need to modify which will not be overwritten by a theme update.
Read the Change-log.
Nearly all good plugins and themes have a public changelog which you can view (usually from a link on the WordPress update screen). This log documents changes which are in the update; It can be important to give these logs a quick once-over to ensure that there is no mention of potential issues that could arise when updating from your current version to the latest. They may also contain details of necessary steps which should be performed after updating – such as confirming settings that you have entered previously.
When Thing’s Go Wrong
Sometimes even the most meticulous web masters can break their site with seemingly straightforward WordPress updates, but what do they do then? If things didn’t go as planned, here’s a few more quick tips to get you back up and running, and find out what went wrong.
Use your backup!
While your efforts may seem wasted initially, thank your self for taking the time to make a comprehensive backup before you started (You did make that backup, right?!). The quickest way to get back online is to restore your backup, taking your site back to just before you begun the updates.
If you didn’t make a backup, hang your head in shame then make a backup now before things get any worse, and continue to the next tip!
Inspect server logs.
Almost all hosting providers will give you access to a set of log files from the web server. Depending on your hosting arrangement, this maybe something that you can access through a control panel, download over FTP, or request from your hosting provider directly using their support service. Look at the timestamps in the log around the time that you completed the updates (when things went wrong). If you have multiple logs, the “error_log” (or similar) will probably contain the most clues (if any).
Viewing your server logs could give you a pointer to the plugin or theme which is causing the error (look at the file paths in the log). Once you track down the culprit, try temporarily moving the suspected plugin folder (for example “MyCoolPlugin”) out of the “plugins” folder within wp-content. The same applies to themes.
Enable WordPress Debug.
WordPress has a built-in debugging mode which can easily be enabled to reveal error messages in the browser when you access your site. To enable debug mode within WordPress, edit your “wp-config.php” file changing (or adding, if it’s not already there) the following line to be “true” like shown:
Once you have done this, try and access your website through your preferred browser – you may see PHP errors, warnings, and notices which may help you to track down the plugin or theme that has caused the issue. It doesn’t hurt to search for the error online, to see if another WordPress user has encountered it before and how they resolved it.
Be sure to disable debug mode once you have finished by setting this option back to “false”!
Getting Help from a Pro
If all else fails, or you simply don’t have the time to fix the issue yourself, there are companies which for a nominal fee will attempt to repair your site for you. We can offer this service, too! If you’re in a similar situation then get in touch!
Larger professionally managed WordPress sites (such as the ones we at Gambit Nash can offer) usually have a separate development environment where updates can be tried and tested before being performed on the live instance of the site.