Webtecho Blog

Whaat…. is wp_debug ? How to debug WordPress Problems?

in General

The first choice of a blogger is to use WordPress as CMS. It is indeed a good choice.

It can be really messy though if something breaks ( for example a theme or a plugin) and all you get is blank screen ( most of the time ). If you know a little bit about PHP , your friend in need will ask you to go to the file wp-config.php , open it and set the variable value of WP_DEBUG as true.

define('WP_DEBUG', true);

This was previously ( or by default ) set as false

define('WP_DEBUG', false);

If you are not well versed with PHP , your first reaction is PANIC.

But don’t worry, it is not a backbreaking change and you just need a notepad to change it back to original. You can always set it back to false if you face any problem. Just make sure you have access to the wp-config file.

So what does it do?

From codex :

Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed.

WP_Debug will enable errors/warnings thrown by your WordPress application and various plugins/themes used by it. That means it will throw up any error , that is causing problems to your WordPress installation such as following ( may be not in color but in black font on white screen)

image

The error here is that a constant is being used without defining it first

image

Because of this the error occurs at the particular line number at a file location.

image

Now all you need to do is to send this information to developers of plugins/themes that you are using and they will correct this error. Once you correct all the errors you should see no errors/warnings at all. In that case you should just set the variable back to false.

define('WP_DEBUG', false);

Caution: On your live site never allow this to be true for long time. Just copy the error and set the WP_DEBUG back to false.

On your test site you should always keep it to true to see any bugs in advance.

{ 0 comments… add one now }

Leave a Comment

Current ye@r *

Previous post:

Next post: