Query Monitor: A Remarkably Comprehensive Debugging Plugin for WordPress

Yesterday John Blackbourn publicly released Query Monitor, a brand new debugging plugin for WordPress. Query Monitor gives developers an easy way to monitor database queries, hooks, conditionals, HTTP requests, query vars, environment, redirects, and more. The repository is trending on github today as more WordPress developers are discovering it.

There are many excellent debugging tools available for WordPress, but this one does a few unique things that are truly noteworthy. Query Monitor provides automatic AJAX debugging and the ability to narrow things down by plugin or theme.

Once installed, the plugin adds a new admin bar menu that gives you a quick overview of the current page.


Click on any item in the menu and it will display complete data in the footer of the page. Here’s a sample output of clicking on “Hooks” in the Query Monitor menu. It displays all hooks fired on the current page with their priorities.


Query Monitor has more features than we can list here, but this is a quick very abbreviated list:

  • Shows all database queries performed on the current page
  • Shows affected rows and time for all queries
  • Shows notifications for slow queries and queries with errors
  • Shows any transients that were set, along with their timeout, component, and call stack
  • Shows all WordPress conditionals on the current page, highlighted nicely
  • Filter displayed actions by component (WordPress core, Plugin X, Plugin Y, theme)
  • Shows the template filename for the current page
  • Shows the available body classes for the current page
  • Shows all HTTP requests performed on the current page (as long as they use WordPress’ HTTP API)
  • Whenever a redirect occurs, Query Monitor adds an X-QM-Redirect HTTP header containing the call stack, so you can use your favorite HTTP inspector to easily trace where a redirect has come from
  • Shows various PHP information such as memory limit and error reporting levels
  • Shows various MySQL information, including caching and performance related configuration

That is only a small sampling of what is built into Query Monitor. You can use it to debug themes and plugins, find out why a WordPress site is running slow, track down mysterious redirects, and anything else you want to cook up.

I put the plugin on my dev environment and was blown away by how easy it is to use. The output is displayed in an organized, readable fashion. Query Monitor is aces. You can download the plugin from github or get it from wordpress.org via the WordPress admin. This is one debugging plugin you’ll want to bookmark for your toolbox.


11 responses to “Query Monitor: A Remarkably Comprehensive Debugging Plugin for WordPress”

  1. Sarah, this could be one of the best finds I’ve seen in a long time! Thanks for sharing.

    More importantly, Thanks to John for writing it. One of my custom post types is doing 52 queries on a view. Even if the data is cached, that’s a lot.

    If you’ll excuse me, I have some work to do.


Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: