Nov
11
2008

The WordPress Admin Panel and The Blank Screen of Death

by   |  Posted in Tutorials  |  26 comments

A client approached me with an issue that I had yet to encounter while working with WordPress. After he had upgraded to the latest version, he tried to login to his admin panel but was confronted with the horrible blank screen of death. If you have never seen it consider yourself lucky. All of a sudden it appears as if your admin panel no longer exist.

This doesn’t always happen but when it does it can be pretty frustrating to figure out what’s going on. There are many posts online as to what may be causing this annoyance. Some people who have encountered this issue have found the culprit to be plugins (see here). But that wasn’t the case for me. It took me a lot of messing around to figure out what was going on. In the end, it came down to the difference between this…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// ** MySQL settings ** //
define('DB_NAME', 'putyourdbnamehere');    // The name of the database
define('DB_USER', 'usernamehere');     // Your MySQL username
define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
 
// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,
// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/
// to get keys generated for you, or just make something up.  Each key should have a different phrase.
define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
 
// You can have multiple installations in one database if you give each a unique prefix
$table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
 
// Change this to localize WordPress.  A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');
 
/* That's all, stop editing! Happy blogging. */
 
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
?>

and this…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// ** MySQL settings ** //
define('DB_NAME', 'putyourdbnamehere');    // The name of the database
define('DB_USER', 'usernamehere');     // Your MySQL username
define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
 
// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,
// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/
// to get keys generated for you, or just make something up.  Each key should have a different phrase.
define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
 
// You can have multiple installations in one database if you give each a unique prefix
$table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
 
// Change this to localize WordPress.  A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');
 
/* That's all, stop editing! Happy blogging. */
 
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
?>
.

Line #32 is the difference (imagine that period is just a blank line). An extra blank line after the last “?>” caused the whole thing. Bah! I removed that and everything worked great.

About the author:

A freelance web developer living in Montreal who spends most of his time writing for this site and building Premium themes for WordPress. You can find him on Twitter @bavotasan.

Site5 Affiliate Link
If you liked this, please share it.

Tags: , , , , , , , , ,

Short URL: http://bit.ly/c3bmt2

Discussion 26 Comments

  1. Lena on May 9, 2009 at 7:19 pm

    Thanks a lot, my wp-admin category.php was showing blank and this fixed the issue.

  2. khokon on July 5, 2009 at 4:22 pm

    i want to remove wordpress admin panel.
    is it possible?

    • c.bavota on July 7, 2009 at 3:33 pm

      You want to remove the whole admin section, or just the dashboard?

  3. Michelle on August 10, 2009 at 11:47 am

    Thank you, thank you, thank you!

    I had the exact same problem and, after 3 hours of googling and trial and error, I finally sorted it thanks to your post. :)

  4. Ted on October 2, 2009 at 2:29 am

    Thank you for this post, it’s a life-saver and a mystery-solver!! I donated $10 for it!

  5. JointMedias on October 29, 2009 at 3:09 pm

    Thanks a bunch dude, this kept happening and I was reinstalling wordpress every damn day until I found this post.

  6. susan Price on February 8, 2010 at 5:18 pm

    I’d love to know where these sites with the problems are hosted. I had a similar problem that we thought was related to Earthlink hosting. Earthlink doesn’t support “later” versions of WordPress, apparently. We’re considering abandoning EarthLink for other hosting, so I’m keen to know for sure.

  7. Vamban on March 22, 2010 at 3:38 pm

    I too experience the same mystery earlier. But unfortunately, i did not find your blog post earlier. Resulted with reinstall the whole wordpress again. Really useful and great post.

  8. Ann Donnelly on April 7, 2010 at 2:01 pm

    Thanks! Pointed me right to my problem — I had edited a file earlier and left a space! Saved me hours of searching and pulling my hair out!

  9. Varun Sharma on April 8, 2010 at 8:22 pm

    Whoa man! You saved me!, i am having same problem, lets see.

  10. Varun Sharma on April 8, 2010 at 8:29 pm

    I tried this but still the same problem!

  11. Mani on April 30, 2010 at 12:28 pm

    This issue had sucked up hours of my week until I found this post. Thanks!

  12. Cristian on July 3, 2010 at 11:42 pm

    Thanks!!!!!! Gracias!!!!!!

  13. Dikla on August 30, 2010 at 10:52 am

    Hey.
    I had valid code I put at the end of wp-config.php and it also screwed up the whole thing, so consider anything you might have added at the end of the file.
    Thanks for the post :)

  14. Mark on December 16, 2010 at 9:06 am

    This post has been a life saver.

    Why do the simple things like a “space” take the longest to find and debug!?

    Thanks again

  15. Marja on February 23, 2011 at 4:24 pm

    Just in case anybody still hasn´t found a solution.
    I had the blank screen on my local xamp set up. The frontend was ok, and I could see all my sites just fine, I just couldn´t get in to admin.
    I ran http://localhost/wordpress/wp-admin/upgrade.php, and now I´m fine!

  16. Honney on March 1, 2011 at 4:21 am

    Hello! I have the same problem with one of my blogs. Question, where do I found MySQL settings? Is it the one inside wp.config.php? Mine looks a bit different.

    Thanks! Hope to hear from you.

    • c.bavota on March 1, 2011 at 10:11 am

      The wp-config.php file above is a little old, but you should still have database settings near the top.

  17. Honney on March 1, 2011 at 4:43 am

    If you’re talking about the wp-config file here. Mine looks longer (up to line 90) and it doesn’t have the extra line or period. Am I looking at the right file?

    • c.bavota on March 1, 2011 at 10:12 am

      If your wp-config.php file has a blank line near the end, it could be causing the blank screen. It might also be something in your theme’s functions.php file. Same blank line at the end can bring your site down.

    • Honney on March 2, 2011 at 3:28 am

      Hi! I checked the functions.php and it looks okay. :-( What else can I possible check? Thank you so much.

    • c.bavota on March 2, 2011 at 10:15 am

      Have you deactivated all your plugins?

  18. Tim Selaty - TLS Web Solutions on March 6, 2011 at 4:36 pm

    Speaking of blank white screen of death… I had upgraded a WordPress recently from 3.0 to 3.1 and my entire frontend went blank. The backend was perfectly fine, but the public side no matter what I did wouldn’t show up.

    I found a solution, maybe it can help some others:
    http://www.tlswebsolutions.com/wordpress-3-1-upgrade-frontend-blank-site-backend-okay-iis/

    Additionally, if you’re programming in PHP, it’s a good practice to end your PHP files without “?>”. This way, you never have to worry about outputting blank characters to the browser before PHP finishes executing.

  19. Matt Willson on March 18, 2011 at 7:35 am

    Great spot – my problem was in my theme’s functions.php, by deleting the blank lines it’s solved the problem.

    Thanks.

    • zigi on March 23, 2011 at 5:23 am

      Thx Matt! I had the same problem and the removing blank lines from functions.php solved it!!

  20. Leah Rae on April 2, 2011 at 7:46 pm

    It’s odd because my wp-config had the ?> missing which is what caused the entire issue.

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . ‘wp-settings.php’);
    ?>

    It’s fixed now. Thanks for the great post! :)