WordPress has proven to be one of the most reliable and easy to use platforms for website development and publishing posts. However, we always download and install third party themes to amplify the appearance of our website. Just like themes, plugins are also created by the third party to extend the functionality of WordPress. Till now, there are more than 41,500 plugins available at WordPress.org. And, that is why the WordPress community says “There is a plugin for that”. Activation of a buggy theme and plugins can trouble your WordPress installation or WordPress Website. White screen of death, internal server error, error establishing database connection, failed auto-upgrade, connection timeout, and several other errors can create problematic situations for WordPress users.

Here at TemplateToaster WordPress theme builder software, I am going to shed light on the causes of the white screen of death (WSOD) and how to resolve this error. WSOD is a common error in which you get nothing except a white screen; no text, no icon, no image. When you encounter WSOD or any other problem without any error message, the very first thing you need to do is enabling debug mode.

Enable WordPress Debug Mode

WordPress includes a Debug mode that logs any errors detected on your website. It can work as a key to finding the source of an issues. Basically, this acts like a resource for learning more details about any possible errors on your website. If you want to be proactive about your WordPress website, you need to be aware of errors, notices, and warnings. Therefore, enabling WordPress debug mode is solution that redirects all the errors, notices, and warnings shown in the UI to the log file.

To fix WSOD you should know what caused WSOD. However, the screen is dead and there is no error message to tell you what went wrong. Here enabling WordPress debug mode can help you in finding the cause of WSOD. Add these lines of code at the bottom of the wp-config.php

error_reporting(E_ALL);

ini_set(‘display_error’,1);

define(‘WP_DEBUG’, true);

These changes will make WordPress display error messages on the screen and you will be able to locate the cause of the WSOD by analyzing the error.

You might have to stare at the white screen of death due to:

1. Issues With Plugin

A plugin can be incompatible with other plugins, themes or the core files of the WordPress. If you have enabled WordPress debug mode then you will get an error message containing the path of a plugin. Example:

Parse error: syntax error, unexpected $end in /home/name/public_html/wordpress/wp-content/plugins/xyz_plugin/……………

This will help you in identifying the plugin responsible for the death of the screen. Problem due to plugin incompatibility can be solved by deactivating that plugin. In case the WSOD appears after any modification in the back end code of the plugin, delete it and install the plugin with its unmodified version.

WSOD can make you feel helpless if it appears at the place of the WordPress Dashboard. You cannot open the plugins page to deactivate the plugin causing the problem. However, by using an FTP client or the cPanel of your website, you can access the file manager. In the wp-content folder, open plugins folder and delete the plugin causing the problem. Don’t want to delete? Change the name of the plugin folder; it will be deactivated. This works when you exactly know the plugin causing the trouble. In case, you do not know, change the name of the plugins folder. All plugins will be deactivated. Now, reload your website.

If it works, you need to find the plugin responsible for this error. For this, once again change the name of the folder to plugins, go to the dashboard and open the plugins page. There you can see that all plugins are deactivated. Reload website after activating all plugins one by one. The activation of the corrupted plugin will cause the return of WSOD. Now, delete it and install its new version. If the WSOD is still there then you cannot blame plugins.

2. Issues With Theme

When you activate a theme incompatible with activated plugins or core files of the WordPress, it may result in the WSOD. If you have enabled debug mode of WordPress, you will get an error message having the path to the theme.

Parse error: syntax error, unexpected $end in /home/name/public_html/wordpress/wp-content/themes/my_theme/…………….

This can be fixed by switching to the default theme if you can access WordPress Dashboard. If the WordPress Dashboard is occupied by WSOD, then use FTP client or cPanel to rename the folder of the activated theme. This will deactivate the theme causing problem and WordPress will use the default theme. Always remember, do not rename the ‘themes’ folder as the default theme is also there in that folder. Apart from this, an outdated theme can also be a cause of WSOD. Blank space in functions.php can also bring the WSOD in. Replace the modified functions.php with its unmodified version and its done.

Activating a theme having infinite loop also causes the WSOD. A loop is the PHP code used in WordPress theme to display content on a web page. Developers can customize the way posts to be displayed on the web page by adding template tags inside the loop. For example, following loop will display a list of posts with the title, featured image, and excerpt.

<?php if(have_post()): while(have_post()): the_post(); ?>

<h2><?php the_title();?></h2>

<?php the_post_thumbnail();?>

<?php the_excerpt();?>

<?php endwhile; else:?>

<p>No post to display</p>

<?php endif;?>

Here have_posts() checks if there is a post to be displayed or not. If it returns true, the_post() retrieves the next post. If the_post() is not called inside the loop then it will be turned into an infinite loop which will cause WSOD. Therefore, always test a theme before using it in your website.

3. Error in core files

Core files are always thoroughly tested. However, you might forget to add a tag or missed something while adding a code snippet. A blank line at the beginning or extra space at the end of wp-config.php file also results in WSOD. Removing blank line and extra space in wp-config.php will fix this issue. Enabling of debug mode of WordPress will tell you the actual cause of the error. A syntax error in wp-config.php file looks like:

Parse error: syntax error, unexpected ‘<‘ in /home/andreb01/public_html/properties/wp-config.php on line 91

Correct if there is any syntax error in any of the core WordPress files you have modified or replace with an unmodified version.

4. Running Out Of Memory

Many times your WordPress installation runs out of memory and it shows the WSOD error. If you have enabled debug mode then you will get following error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

Memory exhaustion occurs when you fetch too many posts and WordPress does not have enough memory. Themes and plugins occupying more memory leave WordPress with very less memory to do its job. To fix this issue, you need to increase the allowed memory limits of your WordPress installation. Here is how it can be done:

Add following line of code in wp-config.php file

define(‘WP_MEMORY_LIMIT’, ‘128M’)

If PHP.ini is accessible, set memory limits as given in the following line of code:

memory_limit=128M; Maximum amount of memory a script is allowed to consume (128M)

If you cannot access PHP.ini then add following line of code in .htaccess file:

php_value memory_limit 128M

5. Invalid File Permission

WSOD can also stem from invalid or wrong permissions and ownerships. Wrong permissions often make your website vulnerable. These permissions are granted to the user (owner of the file), group, and visitors of a website. A permission is a set of three numbers:

First number: What the user that is the owner of the file can do.

Second number: What the group that is other users like members of the website can do.

Third number: What the visitors of the website can do.

WordPress permissions and corresponding numbers are:

Read: 4

Write: 2

Execute: 1

Permissions can be changed either by using FTP client, cPanel’s file manager or server’s terminal using chmod command

sudo chmod 644 <file>

In this permission mode, owner of the file can read (4) and write (2) a file, group and visitors can read (4) a file.

If the WSOD error is arising due to invalid permissions then:

Permissions for all directories should be 755 or 750

Permissions for all files (except wp-config.php) should be 644 or 640

and, Permissions for wp-config.php should be 440 or 400.

It is never recommended to use 777 permissions for files and folders as someone can upload and execute a malicious file or modify and execute an existing file to gain the complete access of your website.

Conclusion

WSOD is one of the commonly encountered problems in WordPress. Most of the times, WordPress users find themselves in a knotty situation when Dashboard becomes inaccessible due to the WSOD. Hope this article will help you in solving WSOD error. If we have missed any cause or way to fix WSOD then please share it with other readers of the post. For regular updates, subscribe to us!