WordPress debug bar plugin

If you are a WordPress developer, you really need this debug bar plugin. I just found it after searching and seeing that there was just only one (strange!). Why do I think this WordPress debug plugin is good? Well, you can instantly inspect global variables (GET, POST, COOKIE, SERVER, etc). You can debug both front-end and admin areas. You can find slow queries because this plugin shows the executed MySQL queries and the time it took to execute each one. You have a profiler for measuring performance of your plugins and themes. You can see the errors occurred when loading your WordPress page and more.

Let’s detail this a little bit starting with Globals. This contains information about the global variables. This is helpful because you don’t have to add “print_r($_POST)” everytime to see the results. The highlighting is done using the “highlight.js” library (it highlights 35+ languages and comes with a lot of color schemes. If you ever need a syntax highlighting library, this is one of the best out there.)

WordPress debug plugin example

Profiler is using a lot of work around but there is a reason for this as the author says. First things first. How to add a new points to profiler to benchmark your code. Another point is added using the following line of code:

apply_filters("debug", "My new checkpoint");

Obviously, the second argument should have the name of the function to execute, but in this case it’s not. Is a simple name or title that will be added to the profiler section. The reason why is solved in this way is because of the need of making a plugin-independent. If you will disable this WordPress debug plugin the code will still work so you don’t have to worry about removing all the checkpoints. Btw, the plugin actual name is BlackBox, in case you don’t know in your admin area which one to view.

By default, there are 3 entries in the profiler. Initiated, stopped are self explainable, however “noise” is not. If you want to measure time between two checkpoints, you will need to keep in mind that you have to subtract “noise” from it.

In profiler you will find more information like: time passed since profiler was started or total memory WordPress was using when checkpoint was reached.

SQL is probably the most useful feature of all. In this wab are listed all the SQL executed queries along with time (in milliseconds). Well, actually not all the queries are listed. IF the queries were not executed using WP_Query object, they will not be listed also, if the queries were executed before the WordPress debug plugin was executed they will not show up as well. Keep this in mind, but it’s probably that these things might happen.

Ok, we’ve covered up SQL and Profiler and now it’s time for Errors. By default, WP hides all strict errors, notices and warnings. This is great for production but not helpful when debugging or developing. Therefore in the Error tab all errors are listed even if it’s a simple warning or a fatal error. Keep in mind that each error is listed only once, and if the error occurs more than one time next to the specific error there will be a number that will show how many times the error has been produced.

Well, that’s about it. Hope this helps, because it definitely helped me a lot. Thanks to ditio for this great plugin.

Download plugin

Related Posts

jQuery pagination plugin – tradpaginator

jQuery plugin to organize content in a responsive layout

Text truncation extension to jQuery – trunk8

Create sortable lists and grids using native HTML5 drag and drop API

Leave a Reply