Query Monitor, the essential tool for WordPress developers and admins

I have been using this tool for a long time, both when developing websites and when optimizing them or performing maintenance, and it has become an essential tool. I mean Query Monitor.

What is Query Monitor

To begin with, say that it is a plugin, which you can install and download like any other.

Once installed and active it allows you to identify, measure and debug database queries, PHP errors, hooks and actions, editor blocks, scripts and stylesheets, HTTP API calls and much more.

It includes advanced features such as debugging Ajax calls, REST API calls and user capability checks, or even quickly measuring the performance of plugins, themes or functions.

As you can already guess, it is a very useful tool for…

  • Developers of themes and plugins.
  • Experts in web optimization.
  • Web maintenance managers.
  • Web administrators.
  • And all those professionals concerned about the performance and functioning of their WordPress.

The amount of information and options it includes is immense, with customizable actions that the developer can include in their code to track all types of logs and debugging.

How to use Query Monitor

It is surprising how easy it is to take advantage of its functionalities.

As soon as you activate the plugin, the first thing you’ll see is that in the upper administration bar of your WordPress, a series of data is displayed, from left to right, corresponding to

  • Page generation time.
  • Peak memory usage.
  • Database query time.
  • Number of database queries.

When clicking on the data it opens Query Monitor’s information and debugging interface, initially showing the detail of that data, as well as the cache usage and HTTP status of the page you are viewing.

And so on in every page you are viewing on your WordPress site.

Not only that, but when there are errors the data bar appears in red.

When you pass the cursor, the drop-down list with all the analyses you make is displayed, highlighting in red also where there are errors.

And if you click on the red element it takes you to the specific section of Query Monitor interface where it gives you detailed error information.

From here, already in the interface, you will see that there are lots of tabs from which to visualize enormously valuable data from each page you are visiting, with essential information for diagnostic and debugging purposes.

You can see the database queries that are made, both per applicant and duplicates…

The hooks in use…

The headers…

Conditionals…

And even the variables of the environment…

It also has a series of constants that you can add to the wp-config.php file to configure parameters and settings of the monitor:

  • To show page permissions: define( 'QM_ENABLE_CAPS_PANEL', true );

And a lot more:

  • QM_DARK_MODE Aturn on the dark mode for Query Monitor interface.
    Default value: false
  • QM_DB_EXPENSIVE If an individual database query takes longer than this, it is considered “slow” and a warning is activated.
    Default value: 0.05
  • QM_DISABLED Disables Query Monitor completely.
    Default value: false
  • QM_DISABLE_ERROR_HANDLER Disables PHP error handling.
    Default value: false
  • QM_ENABLE_CAPS_PANEL Activates the permissions check panel.
    Default value: false
  • QM_HIDE_CORE_ACTION Hides the WordPress core in the “Hooks and Actions” panel
    Default value: false
  • QM_HIDE_SELF The Query Monitor itself is hidden from several panels.
    Default value: false
  • QM_NO_JQUERY Do not specify jQuery as a Query Monitor dependency. If jQuery is not queued, Query Monitor will still work, but with reduced functionality.
    Default value: false
  • QM_SHOW_ALL_HOOK Shows every hook that has an action or filter attached to it in the “Hooks and Actions” panel (instead of the action hooks that are triggered during the request).
    Default value: false

And, if this is not enough, in Query Monitor settings, by clicking on the gear icon on the right, you can even select the default editor, from the browser or even installed on your computer.

Practical uses for everyone

But don’t think that Query Monitor is only a tool for programmers, you can give it several uses even if you are an average user, who simply wants to take advantage of the knowledge it offers for, for example…

  • Measure loading times and resources on a page when changing the theme, and thus choose the cleanest and best.
  • Measure loading times and resources in the editor with different SEO plugins, for the same purpose, identify the one that, with equal performance, consumes less resources.
  • Measure the number of requests and resource consumption per page after installing plugins.

Read this post in Spanish: Query Monitor, la herramienta imprescindible del desarrollador y administrador WordPress

Click to rate this post!
[Total: 1 Average: 5]

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top Skip to content