Debugging WordPress – First Step

Unlock WordPress Debugging Capabilities

You’ve navigated to a certain window at the wp-admin area of your website and your site displayed a blank page. It could have been almost any page (for example, you clicked on All Posts) and I am sure that lots of WordPress users experienced this problem at least once.

Before you contact your hosting provider or a friend who is a fellow WordPress user (and it turns out that he is your best friend at that moment 😀 ), there is also some troubleshooting you can do on your own.

Enter WP_DEBUG.  This is a constant inside the wp-config.php file (located at the root directory of your website) which is by default set to false. In some cases, it’s not even set there (it is assumed to be set to false) but in either situation, whenever you stumble across an error on your WordPress website, set it to true. Like this:

define( 'WP_DEBUG', true );

This will allow WordPress to display the exact error message instead of a blank page. It can also help you in a similar situation I described here.

After setting this constant to true, refresh the page where the blank screen was presented and you will see the PHP error and you will also see the exact number of the line of code which caused it. If the code is inside a plugin file, deactivate that plugin. If it’s not, look for answers on the web and check the Stackoverflow and WordPress Support Forum itself.

2 Comments on “Debugging WordPress – First Step

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: