What is Query Monitor plugin?
Query Monitor is the essential WordPress developer debugging plugin, providing detailed profiling data directly in the WordPress admin bar for every page request. Rather than requiring external tools or code instrumentation, Query Monitor displays database queries, hooks and actions, PHP errors, HTTP API calls, redirect chains, REST API requests, block editor data, environment information, and conditional tags — all in an overlay panel accessible from any page on the site.
The most valuable feature for performance debugging is the database query list: Query Monitor shows every SQL query executed during the page request, including the query itself, the time it took, and — critically — the calling component (plugin, theme, or WordPress core function) responsible for executing it. This makes identifying slow queries and the plugins that generate them a matter of seconds rather than hours of code archaeology. Queries that take over a configurable threshold (default 0.05 seconds) are highlighted in red for immediate visibility.
Query Monitor is completely free, with no premium tier, and is maintained by John Blackbourn — a longtime WordPress core contributor. It is the standard diagnostic tool used by virtually every professional WordPress developer and should be in every developer’s toolkit alongside Xdebug and browser DevTools. Because it outputs profiling data to the DOM, Query Monitor should be disabled or restricted to administrators on production sites to prevent performance data from leaking to visitors.
Need Help With Query Monitor Setup, Troubleshooting, or Customization?
Need help with Query Monitor? Whether you are dealing with errors, broken functionality, styling problems, plugin conflicts, or advanced customization, we can help you fix the issue and get the plugin working properly on your WordPress site.
Get Query Monitor Expert HelpKey Features
- Database query logging: query text, execution time, calling component
- Hook and action execution tracing with callback list and timing
- PHP errors and warnings with stack trace
- HTTP API calls (wp_remote_get/post) with response time
- Redirect detection and redirect chain display
Pros & Cons
Pros
- Most comprehensive WordPress debugging tool available at zero cost
- Database query attribution to specific plugins and themes — pinpoints performance bottlenecks instantly
- PHP error display with stack trace without needing wp-config.php WP_DEBUG changes
Cons
- Should be restricted to admin users on production sites — exposes profiling data and server environment information
- Adds slight overhead to page load when active — not a plugin to leave enabled on high-traffic production sites
Free vs Premium
Completely free. No paid version.
Common Problems & Fixes
Query Monitor is showing hundreds of database queries on a page — which ones should I focus on?
In Query Monitor’s “Queries” panel, sort by “Time” (descending) to identify the slowest queries first. Queries highlighted in red exceed the slow query threshold (default 0.05 seconds) — these are the priority targets. Look at the “Caller” column to identify which plugin or theme is responsible. If a single plugin is generating 50+ queries per page, investigate whether it has caching or a more efficient query approach available. The “Duplicates” panel shows identical queries executed multiple times — deduplication via transients or object caching can significantly reduce query count.
Query Monitor is showing a PHP error from a plugin — how do I track down and report the issue?
In the Query Monitor “PHP Errors” panel, the error message includes the file path, line number, and a stack trace. The stack trace shows the complete execution chain that led to the error. Share this information with the plugin developer when reporting the issue — the file path and line number are essential for diagnosis. For notices and warnings (non-fatal errors), they often indicate deprecated function usage or undefined variable access that the plugin developer can fix. For fatals, enable WP_DEBUG_LOG and WP_DEBUG in wp-config.php to capture errors before Query Monitor loads.
Query Monitor shows "headers already sent" warnings — how do I trace the source?
In Query Monitor’s “Redirects” panel, a “headers already sent” error typically appears when PHP output occurs before WordPress has sent HTTP headers. The Caller column identifies the source. Common causes: BOM (Byte Order Mark) at the beginning of a PHP file — open the offending file in a text editor and save without BOM encoding; premature output from a plugin echo statement before the template loads; a theme functions.php file with whitespace after the closing PHP tag. The file:line reference in Query Monitor pinpoints the exact location.
Customization & Developer Notes
How do I restrict Query Monitor to administrators only to prevent data leakage on production sites?
By default, Query Monitor shows its overlay to users with the “view_query_monitor” capability, which is granted to administrators. To restrict further: add the following to your wp-config.php or theme functions.php: define(“QM_DISABLED”, true); to disable globally, then enable per-user via User Profile settings. Alternatively, add add_filter(“user_has_cap”, function($caps) { $caps[“view_query_monitor”] = false; return $caps; }); and grant it selectively. On shared staging environments, use QM’s environment detection to disable on specific server configurations.
How do I add custom data to Query Monitor's output from my theme or plugin?
Query Monitor provides a QM Collector API for adding custom panels. Create a custom collector class that extends QM_Collector and a renderer class that extends QM_Collector_Renderer. Register them via filters: add_filter(“qm/collectors”, …) and add_filter(“qm/outputter/html”, …). This allows adding plugin-specific debugging data (e.g., custom cache hit/miss rates, API call counts, feature flag states) as a dedicated panel in Query Monitor alongside the standard panels.
Frequently Asked Questions
Is Query Monitor safe to use on a production site?
Query Monitor is safe for administrator-only access on production, but should not expose its output to regular visitors. The overlay is only shown to users with the view_query_monitor capability (administrators by default). However, Query Monitor does add some overhead to every page request when active — on high-traffic production sites, this overhead is undesirable. Best practice: use Query Monitor on staging/development environments and only temporarily enable on production for a specific diagnostic session, then deactivate.
Does Query Monitor work with WordPress Multisite?
Yes — Query Monitor works on WordPress Multisite installations. It displays per-site and network-level data depending on which admin context is active. On the Network Admin, it shows queries relevant to the network. On individual site admins, it shows site-specific queries. The plugin must be network-activated to be available across all sites in the network.
Can Query Monitor break after updates?
Yes, that can happen, especially on older sites with many plugins. This usually happens when the plugin, theme, and add-ons are updated out of sequence. In most cases, testing on staging catches the issue before it reaches the live site. From experience, backups and changelog reviews save a lot of cleanup time.
What should I check before installing Query Monitor?
Start by checking whether another plugin already does the same job. In most cases, overlap is what creates avoidable conflicts and performance issues. A common issue is installing a plugin because it looks convenient without checking the stack first. From experience, a short compatibility review avoids most of the pain later.