Troubleshooting

Query Monitor for debugging WordPress problems

Reviewed on 2 min read wordpress diagnostico base de datos

Query Monitor is still useful for inspecting a specific request from WordPress. To analyse performance across several requests without leaving a diagnostic plugin active, you also have PHP X-Ray.

Query Monitor adds diagnostic panels to the admin bar. Among other things, it lets you review:

  • SQL queries in the request.
  • PHP errors raised during the inspected request.
  • Calls made through the WordPress HTTP API.
  • PHP environment, web server and effective configuration.
  • Information about hooks, actions and enqueued scripts.

Enable it only during the test and only for trusted administrators: its panels can show paths, queries and internal data. Disable it when you have finished.

Procedure

  1. Note the URL, the action and the time of the problem.
  2. Enable Query Monitor and repeat that same action once.
  3. Open its menu in the top bar and check PHP Errors, HTTP API Calls and Queries first, depending on the symptom.
  4. For a slow or duplicated query, check Caller and Component. The number of queries or their duration alone does not prove which component caused the problem.
  5. Keep the smallest block you need, hide sensitive data and disable the plugin.

Queries by component groups the queries associated with each component during that request. Use it to form a hypothesis and repeat the same action on staging after a controlled change. If the result changes consistently, you will have evidence to update, replace or report the component.

What a single page load does not show

The panel describes the inspected request; it is not a history of every visitor or a monitor of every cron task. A response served entirely from cache may not run WordPress and therefore will not generate this data.

Query Monitor adds extra work to collect information. Compare the same operation under equivalent conditions and then confirm the improvement without the diagnostic plugin. For AJAX or REST requests, use the mechanisms supported by the installed version and always relate the result to the specific request; the bar from a previous page does not automatically describe a later save.

You may also find useful

Something wrong or out of date? Tell us and we will review it.