3 Ways To Fix WordPress Errors To Improve Your Site
How to Fix the WordPress White Screen of Death Error
WordPress is a great CMS, so great in fact that According to W3techs, WordPress has 61.8% of the CMS market share in 2020— more than all the other CMS systems combined. But it can be buggy. And one of the most infamous of these bugs is the dreaded White Screen of Death. If you are here the chances are good that you are trying to find a way to fix the WordPress white screen of death error. The good news is we are here to help.
What is the White Screen of Death Error?
Check the Plugins
Before it went blank, and the WordPress White Screen of Death Error was triggered, what was the last thing you did on your WordPress site? There is a high probability that you will have recently enabled, changed or updated a plugin. The most common culprits behind the WSoD error are plugins, so if you have recently made changes to one, your first step should be to deactivate it.
If you reload your site and everything is back to normal, you’ve already found the root of your problem. You can then contact the creator of the plugin, or log into its support forum for more assistance or to submit a trouble ticket.
However, it’s not that straightforward sometimes. If you have not just added a new plugin, one of the current plugins is still likely to trigger compatibility problems behind the scenes. How can you know if this is the case and find out which plugin is to blame?
Disabling all of your plugins is the fastest fix. That way, you will know as soon as you reload your site whether a plugin is not to blame. You can then activate them again, and in the troubleshooting phase, move on to the next stage.
You can disable all of your plugins at the same time by going to your WordPress dashboard’s Plugins screen and using the Disable option in the Bulk Actions drop-down menu.
You can still do this with an SFTP client or your host’s file manager if you can’t access the backend WordPress admin panel. All you need to do is use your SFTP credentials to connect to your site and then find the folder called wp content/plugins.
You can automatically disable all plugins (since WordPress will not be able to find them) if you rename this folder to something else, such as plugins test. Simply change the folder name back to the plugins when you want to reactivate them.
If, after you have deactivated your plugins, your site starts running again, you can be fairly sure that one of them is at fault. What you need to do now is re-enable them, one at a time, and test the site.
This way, you can easily tell which plugin is broken, because as soon as you activate it, the site will go back down and you will be back at the fix WordPress white screen of death error stage. You can then deactivate the defective plugin again, and for more assistance, contact the developers.
If you’re using SFTP to conduct your troubleshooting, you can do this by creating a new folder and calling it plugins. This will basically make the new folder the plugin directory of your site.
All you need to do now is move each plugin to this folder from plugins test, which will reactivate it. One at a time, move each plugin, test your site to see if it works, and repeat the process until you find the broken one. One note: when you’re finished, you need to remember to transfer all the working plugins into the plugins folder!
Check Your WordPress Theme
Just as WordPress plugins can contain code that is obsolete or incorrect, so can themes. Many themes, especially free ones, can be miscoded, or trigger a conflict with one or more of your plugins.
There may also have been an issue with the installation or upgrade of the theme that left it unfinished. Finally, if you’ve made changes to the functions.php file of the theme, it can cause an error as well.
Fortunately, it’s easy to check to see whether your theme is triggering the WSoD. All you need to do is uninstall it and instead return to a generic theme. You can do this if you have access to the admin dashboard by going to Appearance > Themes. Simply hover over one of the default WordPress themes and click Activate.
You can also do this using SFTP if the admin dashboard is inaccessible. Once again, open the wp content/themes folder and simply rename the theme folder you are currently using.
This will trigger your theme to be deactivated by WordPress, and apply the default theme automatically instead. You can check your site now to see if the WSoD has vanished.
If the issue is resolved by this process, you know that your theme was the cause of the error. You can try removing it and reinstalling the original version if you have recently made adjustments to the theme. If this does not resolve the issue, you will want to refer to the official documentation of the theme or reach out for more assistance to the developer.
Check Your WordPress Site’s PHP Memory
If you have tried the last two troubleshooting fixes and are still staring at a WordPress white screen of death then the problem may be that you have run out of PHP memory.
By default, as implemented by your web host, the cap is normally set at 64MB for PHP memory, but sometimes that’s not enough.
You need to add more memory to your installation to fix this. Depending on your particular setup and host, the exact way to do this will vary, but let’s cover some of the more common methods.
You will normally need to edit a file on your server to increase your site’s PHP memory. This is the php.ini file for most hosts. You can build it via SFTP or Protected Shell Access if this file does not exist on your site (SSH). But, if you have this file already, you can open and edit it right away (also using SFTP or SSH).
All you need to do is add anywhere in the file the following line:
memory_limit = 100M
The number is the MB that you want the PHP memory to assign. Every time, it’s best to increase the memory limit by 10MB, and see if that fixes the issue.
Every time you update the file, you’ll want to increase the memory limit by a small amount and test the site. If your whole website comes back up, you’ve solved the problem!
You can only increase the memory cap by so much, however. There will be a fixed cap for your site and installation that you can not surpass, so you can obviously not continue bumping up the limit indefinitely.
If you hit that PHP memory cap and you find that the white screen of death issue is not solved by increasing the memory cap, you may want to consider updating your current plan. For example, it is likely that shared hosting is no longer enough to run your site, so check out the upgrade options offered by your host to see if they meet your requirements.
How to Fix the WordPress White Screen of Death Error with Debug Mode
It’s time to stop playing nice if you have come this far without finding a solution to your WSoD woes. It’s time we introduced you to the debug mode of WordPress, which is a feature built into all WordPress installations. This is usually switched off because it is solely intended for testing purposes.
Enabling debug mode will create an error log of everything that occurs when your site attempts to load. You may also opt to directly display this information on the page.
You’ll need to update your site’s wp-config.php file to enable the debug mode. This file is an incredibly important building block on your site, because it contains all the information about your database (including your passwords). Therefore, you should refer to the official documentation before you begin to edit it.
Open your wp-config.php file via SFTP, SSH, or your host’s file manager when you’re ready to start debugging. In the code for the file, look for the following line:
Identify(‘WP DEBUG ‘, false);
This is set to ‘false’ by default, as this turns the feature off. To change it all you need to do is:
Please define(‘WP DEBUG ‘, true);
The debug mode will be enabled when you save the file. But how do you see the log that it generates? The debugging error log can be viewed using one of two methods. The first is to create a log file, which you can do by adding the following line to wp-config.php:
Identify(‘WP DEBUG LOG ‘, true);
In the /wp-content/ directory, this will create a file called debug.log. Using most standard text editors, such as TextEdit or Notepad, you can then open and read this file.
You may also choose to directly display error messages on the page. Add the following code to wp-config.php to do this:
Definition(‘WP DEBUG DISPLAY ‘, true);
You can now search your site’s HTML for error logs. The reason you’re doing this is that the log will give you an indication of what might cause the WSoD to appear. The error log should make it clear, if you are lucky, exactly which file is causing the issue. You can see an error like this one, for instance.
Error parsing: syntax error, unexpected $end in /home/name/public html/wordpress/wp-content/themes/your theme/functions.php on line 231
You can see in this case that the issue lies in the file functions.php, specifically on a line numbered 231. You can now open the features file, check the noted line, and investigate to see what the syntax error may have caused. You can save the file as soon as you have fixed the issue and then check your site again.
If you get less straightforward error messages, you can usually enter them to find more information on Google or another search engine. It’s really unlikely that you would come across a completely unique issue, because someone is likely to have encountered your particular problem before and solved it. For help, you may also refer to the WordPress Codex and support forums.
It’s crucial that you remember to disable it when you have finished using the debug mode. This can be achieved by modifying the wp-config.php file again and changing the WP DEBUG line back to false. It can lead to major problems and security problems if this mode is enabled, so make sure you always shut it down when you finish troubleshooting.
It should be noted that this last option is tricky stuff, and should only be attempted if you feel pretty confident messing around in critical files. If not, or if you have tried all these steps and are still looking at a blank screen it’s time to get help to fix the WordPress white screen of death error.
Claim Your Free SEO Audit Now!
Need help with to fix the WordPress white screen of death error?
Other WP issue you just cannot figure out? Get in touch with Pearl Lemon’s expert WordPress development team, they’ll be happy to help.