A WordPress developer working on a slow page tries var_dump($wp_query) in functions.php and the page goes white. They try error_log() and forget where the log file lives. They reach for Xdebug and spend an hour setting it up. Each of those is the wrong tool for the question. Query Monitor, Debug Bar, and Kint solve different versions of “what’s actually happening in this request” — and combined, they replace most ad-hoc PHP debugging on WordPress.
What’s happening
The three tools and what each surfaces:
- Query Monitor — the most useful of the three. Adds a menu bar item with panels for: every SQL query (with EXPLAIN), every hook fired, HTTP API requests, transients, the active templates, REST API requests, capability checks, redirect chain, PHP errors. Available on every page load when logged in. Best tool for “why is this page slow” and “which plugin is doing this.”
- Debug Bar — the precursor to Query Monitor. Smaller surface, less polished UI. Still maintained because some custom debug-bar-extender plugins target it specifically. Skip unless one of those plugins is in play.
- Kint — a
var_dumpreplacement. Loaded as a plugin or as a composer dep, it givesd($var)anddd($var, $other)that produce expandable, syntax-highlighted variable dumps. Replacesvar_dump/print_rfor ad-hoc inspection. Most useful inside template files, hooks, orevalcalls.
The three answer different questions:
- “What did this request do?” → Query Monitor.
- “What’s in this variable right now?” → Kint.
- “I need a quick dump of a specific thing” → Kint, possibly via WP-CLI eval.
How to verify
Confirm the right tools are present on your dev/staging setup:
wp plugin list --status=active --format=csv | grep -iE 'query-monitor|debug-bar|kint'
Query Monitor should be in the list on every WordPress install used for development. Debug Bar usually isn’t necessary if Query Monitor is there. Kint should be there if developers do any PHP-level inspection.
For Query Monitor to be useful, WP_DEBUG should be true on the install:
wp config get WP_DEBUG
If it’s false, QM still works but loses some detail. For staging, set:
// wp-config.php (staging only)
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', '/var/log/wordpress/debug.log');
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', true);
What to do
The setup and the workflow that gets you the most out of these tools.
- Install Query Monitor on every dev and staging environment:
wp plugin install query-monitor --activate
It auto-restricts to admin users. The menu bar gets a new item with cumulative timing for the page. Hover for the breakdown; click for the full panel.
-
Query Monitor’s most useful panels:
- Database Queries: sortable by duration. Anything over 50ms is suspect. The stack trace column shows which plugin / function generated the query.
- Hooks & Actions: every hook fired on this request, with the callbacks attached. Use this for “which plugin attached this hook”.
- HTTP API Calls: every
wp_remote_get/wp_remote_postmade during the request. Slow upstream calls show up here as the page-render bottleneck. - Transients: shows which transients were read/written. A page making 200 transient calls is doing too much work per request.
- Templates: which theme template files actually rendered. Useful when the page renders the wrong template (
single.phpinstead ofsingle-event.php).
-
Restrict Query Monitor to specific IPs in non-dev environments (don’t expose query timing to anyone with admin access):
// wp-config.php
define('QM_COOKIE', 'wp_qm_authenticated_xyz123');
Then visit /?qm-auth=on once from your IP to set the cookie.
- Kint setup. Install as a plugin (
kint-php) or via Composer (kint-php/kint). Used()(dump) anddd()(dump and die) in template files or hooks:
// In a template file or hook
add_action('wp_head', function() {
d(get_queried_object());
d($GLOBALS['wp_query']->request);
});
The output is collapsible and syntax-highlighted. For terminal output (via WP-CLI eval), use Kint::$mode_default = 'cli'.
- For WP-CLI exploration, combine Kint with
wp shell:
wp shell
> require_once WPMU_PLUGIN_DIR . '/kint.php';
> d(wp_get_current_user());
-
Production safeguards: none of these should be active on production for non-admin users. Query Monitor restricts itself; Debug Bar requires explicit
WP_DEBUG; Kint should be removed from production composer.json (use the--no-devflag at deploy time, see Composer for WordPress). -
For deep PHP-level debugging that the above can’t help with, set up Xdebug — but that’s the last resort, not the first.
For the surrounding deployment story that keeps these out of production, see WordPress deployment automation. For the dev environment setup, see WordPress local dev environments.
Stack Harbor’s enterprise WordPress support practice ships these tools as standard on every dev/staging environment and audits for their accidental presence in production. If a site has Query Monitor enabled in production (we’ve seen it), we can clean it up and audit the surface.