The blog post will help you fix your WordPress website if it breaks. While WordPress is an excellent choice as a Content Management System there will be times when things go wrong.
The default setup of WordPress is not to display error messages so you are likely to be presented with either the dreaded white screen of death, basic error message or some feature that does not work.
This might be a shopping cart not adding products properly, a contact form not sending mail or a page link not working. If something very serious has happened then you might just get a blank screen.
Sometimes the error is more fundamental and WordPress will tell you the problem if you make some relatively simple edits to a file.
Before you investigate further, make a backup of the current site and check with your web hosts that they have a backup of the last working version of your website files and database.
Database connection error
If you visit your website and see this message:
Error Establishing a Database Connection
Then something has gone wrong connecting to your database with the following pieces of information:
- Database name
- Database host
- Database username
- Database password
Check your wp-config.php file for this information and confirm it is correct for the server and database you should be using.
Internal server error
If you visit your WordPress website and all you see is this type of error:
Internal server error
This means that that was an error on the server but the server software wasn’t able to identify the exact error.
Then it could be something as simple as a temporary problem with your web server so first check with your web hosts that everything is running properly.
There could be multiple reasons for an internal server error that go beyond the scope of this post, however you’ll find some good advice here: Fixing Internal server errors in WordPress websites
Common causes include problems with the .htaccess file, plugin compatibility, inadequate memory or poorly configured web servers.
If there is nothing but a white screen of death (WSOD) then you need to force WordPress to show the error message by editing wp-config.php to make WordPress go into debug mode.
Editing your wp-config.php file to show error messages
If your WordPress is not working or showing a blank screen (the white screen of death), then you need to show the error messages.
Do this by downloading the wp-config.php file through FTP or using your web hosting control panel. The file is located in the root directory of your public html folder.
Take a backup of the file and put it somewhere safe so you can always restore the file before you edit it.
Open up the file in your favourite code editor (Notepad ++ for example) and find the debug mode line:
define(‘WP_DEBUG’, false);
Change the word false to true and save the file and upload it back to the website folder.
Visit your website and note the error message.
This is where you need to check the file and location of the error message. The information in the error message is likely to include the following:
- Line number and file causing the problem.
- Location of the file.
- Type of error.
Typically, it could be your theme or plugins. You could switch to a default theme to see if the website still works.
If it’s a plugin causing the problem then you could try disabling it by renaming the folder in FTP or file manager – remember to retain the main part of the name so you can identify it.
Try visiting the website to see if disabling the plugin has enabled the website to work.
If you have identified the cause as a particular plugin then you need to do the following:
- Update to the latest version of the plugin.
- Update or roll back to a version that worked with your version of WordPress.
- Seek an alternative plugin that does the same job.
- Disable or delete the plugin permanently.
- Check whether it’s a known issue by talking to the plugin vendor and theme provider, raising a support ticket or checking their knowledgebase articles.
IMPORTANT: once you have finished debugging and fixed the problem, edit the line…
define(‘WP_DEBUG’, true);
…so you change true back to false. This will stop error messages displaying on sites that are working ok but may have some small issue with a file or plugin that isn’t so serious.
If debug mode doesn’t show error messages
If debug mode doesn’t show an error message and your WordPress is still not back online then you will need to check the raw log files for your website hosting.
Go the to the control panel for your website and look for the download log file or error log icon.
For some web hosting you can view the error logs almost live, for others you’ll have to download the log file and sift through the data to spot the error messages and what folders or files they refer to.
This can be daunting to begin with but you soon get a feel for spotting the files or folders are the source of errors.
This will help you diagnose and then start finding a solution.
Although we have covered how to fix WordPress if it goes wrong, it is a robust and reliable content management system. There is a ready supply of experts able to help if your WordPress website breaks and a good web host will be able to supply a backup of your website so you can roll back to the last working version.
Get in touch with Dinesh on 07941 686113 if you need help on web design, web hosting, SEO services, domain names or email marketing.