Query Monitor is the one debugging plugin we install on every WordPress investigation. It surfaces slow queries, expensive hooks, HTTP API calls, and hook timing in a single admin bar dropdown. The catch is that most users only look at the “Queries” panel and miss the rest — and a few of the panels can leak secrets in production if you don’t configure access correctly.
What’s happening
Query Monitor hooks into WordPress early and captures every database query, every hook fired, every HTTP API call, every template loaded, and every PHP error raised during the request. It renders all of that as a panel attached to the admin bar, viewable only to users with sufficient capability. By default that’s any administrator, which is too broad — you want to restrict it to a specific user ID or a known IP range for production.
The panels you care about: Database Queries (slow query timing, duplicate queries, queries by caller), Hooks & Actions (which hooks fired and which callbacks attached to each), HTTP API Calls (outbound wp_remote_get and friends, with timing), PHP Errors (notices and warnings captured for the current request only), and Component Times (time spent per plugin and per theme).
How to verify
Install and enable, then configure the access constant in wp-config.php:
define('QM_COOKIE_NAME', 'qm_authorized_' . COOKIEHASH);
// Or, for IP-locked access in production:
add_filter('qm/dispatch/html', function($dispatch) {
return in_array($_SERVER['REMOTE_ADDR'] ?? '', ['203.0.113.5']) ? $dispatch : false;
});
In the admin bar, click the QM dropdown to expand each panel. Use the “Queries by Caller” tab to spot a plugin issuing 200 queries per pageload, or the HTTP API panel to find a remote call that’s adding 800ms to TTFB.
The fix
- Restrict access in production. Set
QM_COOKIE_NAMEand useQM_DISABLEDto hide the plugin from regular admin users. Only your operations IP range should see the dropdown. - Use the “Slow Queries” filter. Any query over 50ms is a candidate for an index or a plugin replacement. Click through to the caller to see which file fired it.
- Watch HTTP API calls during cron runs. Run
wp cron event run --alland check the HTTP API panel. A plugin calling an external API on every cron tick is a common 504 cause. - Read the Hooks panel for action ordering. When a callback isn’t firing, the Hooks panel shows whether your callback was registered, at what priority, and whether something earlier in the chain returned and short-circuited it.
- Enable the Component Times panel. A single plugin taking 600ms on every request is invisible in average TTFB but obvious here.
- Don’t leave it enabled forever. Query Monitor adds overhead. Disable it once the investigation closes, or use the
mu-pluginsloader pattern to enable it only when a specific cookie is present.
For sites where this kind of investigation needs to happen across dozens of installs, Stack Harbor includes Query Monitor as part of the standard managed enterprise WordPress hosting toolkit. To get a walkthrough on your install, book a consult.