Turn On Error Reporting on WordPress Blank / White Screen of Death

There is nothing worse than getting blank screen when developing for WordPres – also ‘officially’ known as The White Screen of Death – because you have no idea what went wrong. No errors, nothing useful, just blank screen. It’s even worse when it just appears out of nowhere. This happened to me few times in the past and then just recently. Woke up in the morning and the entire site (not this one) displayed just blank white page.

First thing you should do is rename the plugins folder and see if it works. If yes then the problem is in one of the plugins so if your admin works start disabling plugins one by one. If admin doesn’t work then try renaming plugin folders via FTP. If this doesn’t help then rename the themes folder and see if the problem was caused by one of your theme.

This didn’t help in my case. So I went to WordPress site (link below) and insert the code they recommended! It STILL didn’t work and there were no errors displayed! So finally I modified the code a little and finally the error appeared! I don’k know why are they posting a solution that doesn’t display the errors.

Here is the code that started showing errors and I finally able to fix it. Still the mistery remains why did the blank screen start appearing when it was working just fine yesterday when I went to bed. Ah, the ‘joys’ of developing.

Open the wp-config.php file in the root directory of your worpress and insert this just above the /* That's all, stop editing! Happy blogging. */ comment. Refresh the WordPress and hopefully you will see PHP error telling you what went wrong.

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

// Enable display of errors and warnings 
define('WP_DEBUG_DISPLAY', true);
error_reporting(E_ALL);
@ini_set("display_errors", 1);

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define('SCRIPT_DEBUG', true);

After you fix the error don’t forget to remove or at least comment the added code.

In case it didn’t work, here are some more steps to try to fix it:

Common WordPress Errors and Debugging in WordPress

Redirect all requests for the domain root to a specific page

This is for WordPress but can be used in any site because it uses .htaccess.

I needed to redirect all visitors that visit the root URL (for example elcoderino.com) to specific subpage (eg elcoderino.com/subpage). WordPress allows you to create a static front page or select a custom page that will replace default front page content but in my case it just didn’t work. Maybe it was combination of Advanced Custom Fields or custom post types but it just kept messing up the front page.

So the solution is to add this to your .htaccess file:

RewriteEngine On
RewriteRule ^$ /subpage/ [R=301,L]  

if your .htaccess file already contains RewriteEngine On then simply just add RewriteRule ^$ /subpage/ [R=301,L] below it.