diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)

Aug182010

WordPress Debugging Hack For WordPress ‘white screen of death’

“WordPress white screen of death” sound dreaded, here’s a quick hack that allows me to quickly switch on debug mode when needed. The hack is in three versions: First is a simple one that you can copy in wp-config.php:

if ( isset($_GET['debug']) && $_GET['debug'] == 'debug')
  define('WP_DEBUG', true);

Second, one can also be copied in wp-config.php, and it checks for the admin account to get you debug access:

global $current_user;
get_currentuserinfo();
 
if( isset( $_GET[ 'debug' ] ) && $_GET[ 'debug' ] == 'secret' && $current_user->user_level > 7  )
 define( 'WP_DEBUG', true );

Third, on is in the form of a plugin, that you can either copy in your functions.php or create a simple plugin file using following code:

add_action( 'init', 'my_debug');
function my_debug() {
   if( current_user_can('update_plugins')
       && isset( $_GET['debug'] )
       && $_GET['debug'] == 'secret'
       && !defined( 'WP_DEBUG' )
   ) { define( 'WP_DEBUG', true ); }
}

Now, if open any page, and if something goes wrong there, like a white screen of death, — just add ?debug=debug to its URL and see what’s causing the trouble. Note: Change the second ‘debug’ to a key of your own, so not everyone out there can open debug mode on your blog.

[Source]

Share This Story, Choose Your Platform!

Get Latest News

Subscribe to Digital News Hub

Get our daily newsletter about the latest news in the industry.
First Name
Last Name
Email address
Secure and Spam free...