Query Debug Info plugin

query_debug_info_query

I wanted to have this plugin when I was beginning with WordPress and I did have to use multiple loops in one template.

This simple plugin adds some overlay tabs in the left side of the screen with information about the constants of the theme like (WP_CONTENT_DIR, WP_PLUGIN_DIR, TEMPLATEPATH, STYLESHEETPATH, etc..) and infomation useful to debug your loops like the of type you are currently viewing, the query results (post_count, found_posts), the query vars used and the query used (the raw SQL generated by WordPress.

How to use this plugin

After activating the plugin you can add the function call in your template to display information about the main query:

<?php if (function_exists(‘debuginfo’)) { debuginfo(“Main”); }?>

Add additional calls after creating a new WP_Query object, if you want to track a specific variable you can pass it to the function, example:

<?php $my_query = new WP_Query(“showposts=3&category_name=Featured&order=DESC”); ?>
<?php if (function_exists(‘debuginfo’)) { debuginfo(“Secondary”,2,$my_query); }?>

The information is only displayed if you are logged in as an administrator.

More screenshots of this plugin and the download link in the Query debug info page or you can download it from the Query debug info page in wordpress.org

Comments are closed.