Solution to WordPress Blank Web Pages without error Display

Are you getting blank pages on WordPress without any error displaying on web browser? I got this error when I have deactivated the W3 Total Cache and with that removed subdomain used as cdn. Therefore, I have shifted all the media files to normal upload directly. In the process I did mistake and my blog stops working. I started looking for various clue and after very long time I got solution.

I was confused on the files I need to replace from CDN to usual WordPress wp-content folder. I have lots of plugin installed. Finally just come to know that W3 Total cache only use images (gif, png etc), JavaScript files and CSS files of your theme. It does not use plugins static files only theme static files from CDN.

After trying various methods of checking and checking again of files shifted, comparing  .htaccess file on both root and wp-content folders with original wp-content and cdn folder files, I came to know that I have accidentally used old header.php file and new functions.php files. That is why I was getting empty pages. I have written few functions there on header.php file and latter shifted to functions.php file. Therefore, in my case, my written functions were defined at two places. It resulted in Fatal Error.

Thinking about any of these cases, I have written error_reporting(E_ALL); at header.php but that did not worked. I think the header page come very late in execution in WordPress framework. I was sure that if I would have any PHP related error then the error reporting function should have solved by telling where the error on my page is. After installing WordPress's maintenance plugin, I was sure that no one else will get error page and it will not affect my web site security. Maintenance mode plugin is a great aid in these kinds of situations.

Finally, the solution worked for template blank pages was setting debug value to true in wp-config.php file. Use this line in wp-config.php file:

define('WP_DEBUG', true);

After using this setting, I got a relief. I came to know all of the error that was causing my web page not to appear in web browser. As I said, one reason was my functions were defined at two places and others were few plugins functions directly called for plugins.

Fatal error: Cannot redeclare jscodeexternal() (previously declared in /xxx/xxx/public_html/wp-content/themes/simple/functions.php:524) in /home/satya612/public_html/wp-content/themes/simple/header.php on line 38
Fatal error: Call to undefined function generalstatscomplete() in /xxx/xxx/public_html/wp-content/themes/simple/footer.php on line 91

Now, you know what to do in this case! Just use the above setting in wp-config.php file, and develop practice that whenever you call a plugin's function then call it like this:

   if (function_exists('generalStatsComplete')) generalStatsComplete();

If you develop a practice of calling WordPress plugin function like the above then if after disabling the plugin, your template will not produce Fatal Error.

After your debugging is over, do not forget to disable the debug mode. Just change the value from true to false.

define('WP_DEBUG', false);

You can delete the whole line also, but this way you may forget (like me) to use it when time come for it!

Hope this will help you and save your time on future!

Here is the reason for error_reporting() not working in header.php. In wp-settings.php, you can find these lines of code:

if ( defined('WP_DEBUG') && WP_DEBUG ) {
	if ( defined('E_DEPRECATED') )
		error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
	// Add define('WP_DEBUG_DISPLAY', false); to wp-config.php to use the globally configured setting for display_errors and not force it to On
	if ( ! defined('WP_DEBUG_DISPLAY') || WP_DEBUG_DISPLAY )
		ini_set('display_errors', 1);
	// Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log
	if ( defined('WP_DEBUG_LOG') && WP_DEBUG_LOG ) {
		ini_set('log_errors', 1);
		ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
} else {
	define('WP_DEBUG', false);
	if ( defined('E_RECOVERABLE_ERROR') )

Do you like to tweet or share on Facebook for it! Sharing is caring!

Here is another post mentioning the solution of this problem. Check the 2nd half of the article.

  • # 1 - by Ray

    Thank you for this! I could not figure out a problem with my theme but with the wp-debug was able to. Thank you very much!

Comments are open for an year period. Please, write here on Facebook page.