Ready to get started?Download WordPress

Plugin Directory

Debug My Plugin with Debug Bar

Debug your plugin with the help of Debug Bar. Puts debugging messages in the drop down Debug Bar interface.

After a trip to WordCamp I learned about a cool new utility to help tighten up my plugin development, Debug Bar. When I got back home the first thing I did was install Debug Bar. Then installed a dozen other plugins related to Debug Bar.

While many provided some very cool and very useful "inside data" that did help with my plugin development, a key feature I was looking for was missing. I wanted a simple way to add my own personal debugging output to Debug Bar. After a couple of hours of searching I decided I'd write my own.

And here it is. Now I can debug any of my plugins with ease.

Install Debug Bar.

Install Debug My Plugin.

Use the Debug My Plugin methods in my code and look at my own internal messages when I need to see what is going on.

[youtube http://youtu.be/20dOoa77_DU ]

Your Dev Helper

You "talk" to this plugin via the DebugMyPlugin global and use that to set properties or invoke methods.

This global, $GLOBALS['DebugMyPlugin'], is a named array that starts out with a single panel object called 'main'. If you want to, you can just work on this "scratchpad" for output.

This method will output a print_r dump of a variable, like a named array: $GLOBALS['DebugMyPlugin']->panels['main']->addPR('Big Array is now:',$bigArray,FILE,LINE);

This method is for simple string based messages, HTML supported: $GLOBALS['DebugMyPlugin']->panels['main']->addMessage('I Want To Say:','Hello World');

Hack Notes

There is a notable hack in this plugin that impacts Debug Bar. Turns out Debug Bar rendering is called somewhat early in the stack. At the action hook 'wp_after_admin_bar_render', as a matter of fact. Problem is, that renders BEFORE admin page contents are rendered. Reading the Action Reference you wouldn't think that was the case... or I didn't anyway... but it is. As such the variables I wanted to see were not dumped to the Debug Bar panel. Thus, I moved Debug Bar render() to the 'shutdown' action hook. This runs AFTER the entire admin page is built. Maybe there is a better place to hook it, but for me, that is what worked so that is where it lives. Disable this plugin and the call order goes back to normal. BTW, you will see some extra errors and warnings because of this, apparently from things that are happening "late in the game" that Debug Bar was sort of glossing over. Doesn't seem to break anything, but thought you should know. This is a 0.1 release after all!

Version 0.2 now turns off the default panel on AJAX calls. This was wreaking havoc when I had Debug Bar activated and wanted to look "under the covers" of my JSONP requests.


Support for the plugin can be found on the CSA Website. If you have an urgent issue or want one-on-one support you can purchase premium support.

My Philosophy

I strive to create code that runs efficiently and without bugs. In my opinion, well-written plugins are few and far between. While there are plenty of plugins that look nice, far too many of those plugins, including the "cool shiny ones" have too many hidden problems. I have found that over 90% of the plugins available on the WordPress plugin directory generate dozens, if not hundreds, of warnings and errors when you turn off the "hide all the problems" settings.

These hidden problems impact memory usage, fill up disk space, and reduce performance via the typical default logging settings. While you may not see the errors on your WordPress site, they are still being tracked. The more errors, the more disk I/O, the slower the app.

During 20+ years of software development, I have found that leaving "innocuous" warnings in place tends to lead to trouble further down the road. Warnings today often become errors tomorrow. Many programming languages, PHP included, continue to tighten security and close loopholes that are typically found living near all those warning messages. Some warnings are telling you to "change this now, it will be gone tomorrow". Eventually tomorrow will come.

While my plugins may not be the prettiest on the block, I do try to make sure that all the hidden stuff you don't see is designed as well as it can be. My code is not perfect, but when I find a bug I try to fix it fast. If I create a bug I try to fix it even faster. To sum it all up, I like to write plugins that last. I hope you appreciate my work.

Rate This Plugin

Please rate this plugin! Rating the plugin, hopefully with 5 stars, helps increase the exposure on WordPress, which generates more downloads and purchases of add-ons. The more add-ons I sell the easier it is to put food on the table and give me more time to code cool new features. No ratings, no food, more hours working as the Walmart Greeter, less coolness in the plugins.

Give me a chance to address your concerns if this plugin doesn't earn 5 stars by contacting me directly or by posting in the support forum at the CSA website.

Special Thanks

Requires: 3.3 or higher
Compatible up to: 3.9.2
Last Updated: 2014-4-25
Downloads: 5,571


4 stars
4.7 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1