Chip's Tips for Developers

Contains coding, but not narcotic.

WiPeD debugger for WordPress now has traceback

October 10th, 2009 4:13:41 pm pst by Sterling Camden

Sam Mela liked my WiPeD debugger for WordPress, but he wanted an easy way to include call traceback information.  So he added it, and he kindly shared his addition with me.

I’ve adapted what he did to my own tastes and included it in the download below.  Whenever you want to add the current call stack to the debug log, just call:

WPD_backtrace();

In order to test this, I added a new option in the Options page:

Trace the following actions (comma-separated)

Just enter the name of any action hooks on which you want to get a traceback added to the debug log.  This is not only useful for testing the plugin, it can also be used to find out where in the twisty little passages of WordPress each of the actions gets invoked.

Largely because of this feature, I now initialize this plugin whenever it is activated.  Previously I delayed setting it up until WPD_print was invoked.  So this plugin now imposes a small overhead if it is activated and not used.  Be advised.

I also adopted Sam’s idea of providing default styling (which I modified significantly).  If you don’t like it, you can remove or modify WiPeD.css.

Posted in CSS, PHP, Web, WordPress | 2 Comments » RSS 2.0 | Sphere it!

2 Responses to “WiPeD debugger for WordPress now has traceback”

  1. John says:

    Dang… I just don’t see anything when I put this in the website. This is exactly what I was looking for. I’ll have to try it on a few different installations. I’m sure I’ll eventually get it working.

    • By default, the output should occur on the get_footer and admin_footer actions, but that can be customized in the options.

      Nothing will be printed, of course, unless you call WPD_print or WPD_backtrace somewhere in your code.

Leave a Reply

Better Tag Cloud