I have been reading up on debugging. I watched Chip Bennett's video on wordpress.tv and was inspired to take debugging seriously. What I have found in my reading up though has confused me a bit. I know about define( 'WP_DEBUG', true ); and some of the debug plugins like 'debug bar' and 'firephp' and also 'log deprecated functions', and having read this I fine plenty more ways to debug WordPress, but I can't conceive an overall strategy.

What I mean is: is it ok to just use just define( 'WP_DEBUG', true ); ... and if so then what are the plugins for. I think I understand the difference between these and say 'log deprecated functions' for instance but I am slightly blinded by the light I think with regard to the others. I know I could just install each plugin and play with it till I can answer this question but I really had hoped that someone could save me the time with a little direction.

Mainly what I want to know is this: am I right in thinking that define( 'WP_DEBUG', true ); is where it starts and the plugins are just improving on that, so that if I get ONE good plugin that works for me then I dont necessarily need to do anything else (like using a combination of these plugins) ... OR is it probably necessary to use a combination of debugging plugins and aids and if so what are people's recommendations.


You have several tools at your disposal when working with native WordPress debugging.

PHP Debugging - WP_DEBUG is the native WordPress PHP constant for debugging WordPress errors. It sets PHP's error reporting to to E_ALL for warnings when deprecated functions are used and if none are found it sets it to E_ALL ^ E_NOTICE ^ E_USER_NOTICE.

So most of the time setting define( 'WP_DEBUG', true ); is enough.

Ref: http://php.net/manual/en/errorfunc.configuration.php

Database Query
To debug database queries you need to set define('SAVEQUERIES', true); This is a very handy tool that will benchmark and perform some analysis in your $wpdb query.

To debug any javascript you can turn on define('SCRIPT_DEBUG', true);

That is pretty much it in terms of WordPress itself, plugins like the Debug Bar simply make it easy to read the results, since debugging output can be quite messy. For example look at the SAVEQUERIES in the debug bar, it is very easy to read.

There are other plugins that extend the capabilities of debugging because they provide more information and better output, I made a list of some here since this question comes up quite often, http://debugggg.wordpress.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.