EXCLUSIVE DEAL 30% OFF on QODE Wishlist for WooCommerce plugin Discount code: WISHLIST30 EXCLUSIVE DEAL 30% OFF on QODE Wishlist for WooCommerce plugin Discount code: WISHLIST30 EXCLUSIVE DEAL 30% OFF on QODE Wishlist for WooCommerce plugin Discount code: WISHLIST30
EXCLUSIVE DEAL 30% OFF on QODE Wishlist for WooCommerce plugin Discount code: WISHLIST30 EXCLUSIVE DEAL 30% OFF on QODE Wishlist for WooCommerce plugin Discount code: WISHLIST30 EXCLUSIVE DEAL 30% OFF on QODE Wishlist for WooCommerce plugin Discount code: WISHLIST30
BACK TO TOP

What Is the WordPress Query Monitor Plugin and How to Use It

What Is the WordPress Query Monitor Plugin and How to Use It

Whatever development project you undertake in WordPress, you should expect debugging to be a part of it. You don’t even have to do anything that requires coding knowledge to be thrust into a whirlwind of errors and their possible causes. Doing something as simple as trying to figure out why a particular page is loading slowly might require you to dig into your website’s performance well below the surface level.

When it comes to checking the performance of plugins, themes, or simple functions, using the WordPress Query Monitor might not be mandatory, but it can be extremely useful. If you’re not sure what Query Monitor is and how you can start using it, don’t worry.

In this article, we’ll show you:

What Is WordPress Query Monitor?

Query Monitor

Query Monitor is a WordPress plugin that puts some awesome debugging capabilities at your disposal. It shows you all the requests that are made to your server when you load a page, post, or any part of the backend. With Query Monitor, you can see database queries, AJAX calls, hooks and actions, and lots of other things that are going on behind the scenes when loading your website.

Query Monitor, as its name says, monitors database queries. It will show you any duplicate or erroneous queries, or even the ones that are simply taking too much time. The plugin supports filtering by query type, calling function, and responsible component, so you can, for example, only see queries from a certain plugin. You can also sort queries by rows and time.

And that’s just what it lets you see with the queries. With hooks and actions, for example, the plugin will let you filter them by name – for hooks, or by component – for actions, besides listing all the hooks and actions fired on the current request. With PHP, the plugin will make sure you see there’s a problem by putting the error notification in the admin toolbar. It will also give you their components and call stacks to help you troubleshoot. The list of the useful things this plugin lets you do goes on, and it’s best explored from within.

How to Start Using Query Monitor

Because it’s a WordPress plugin, you have to install Query Monitor to be able to use it. Head on over to Plugins > Add New, search for Query Monitor and install and activate the plugin.

How to Start Using Query Monitor

Right away, you might notice something new in the admin toolbar you see on the top of the website. It now shows you some data measurements, and these are, in order, page generation time, peak memory usage, database query time, and the number of queries.

Data measurements

If you hover over this new area in the toolbar with your cursor, you’ll see the dropdown menu showing you all the things Query Monitor lets you track.

Query Monitor lets you track

Clicking on the toolbar item, or any of the options in the menu will bring up the tool. It will pop up in the bottom half of the screen, much like the Inspect Elements tool does in a browser. Just like the browser tool, you’ll also be able to move to the side of the screen by using the button in the upper right-hand corner of the tool.

If you clicked on the toolbar item and not any of its menu options, you’ll be shown the Overview panel. It contains more information about the numbers you’ve seen in the toolbar items.

Clicked on the toolbar

You can see this information on any page or post on your website. You can even use an authentication cookie that lets you view the plugin’s output when you’re not logged in, so you can visit your website as a regular visitor. You can enable the authentication cookies from the plugin options, the same place where you can set your code editor and see the PHP constants you can use to further control the plugin.

Information on any page or post on your website
Qode Themes: Top Picks
Bridge New Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

Navigating the Information in Query Monitor

The plugin will present its information in several panels, and we’ll run through some of the more interesting ones. The one that’s obviously of most interest is the Queries panel. It contains separate tabs for viewing duplicate queries, as well as listing queries by caller and component. You’ll also be able to view the queries by type, caller, and component using the appropriate filter.

Navigating the Information in Query Monitor

If you want to see the query variables – if any – for the current request, you can see them in the Request panel. It’s also the place to look for request headers, response headers, as well as related hooks.

See the query variables

The Blocks panel will list content blocks and associated information if any. The Template panel will show you the template filename in use on the page or post you’re viewing, as well as the name of the active theme, the template parts, and body classes. If there are any hooks in use, you’ll be able to see them, too.

Blocks panel

For a full list of scripts, and the ability to filter them by the host, dependencies, and dependents, look no further than the scripts panel. You’ll see the sources for every script, too, and you’ll be able to access a panel with all the related hooks. You’ll notice there are similar panel styles, too.

Full list of scripts

Hooks & Actions is the panel where all the hooks are listed, together with their priority, action, and the component. You also have filtering options at your disposal, very useful if you want to check a specific type of hook or hooks related to specific components – plugins, theme, or WordPress core.

Hooks & Actions

If there are any HTTP API calls or transient updates, you’ll see how many of them are there in the names of the appropriate panels. You’ll be able to access the information about them, too, and in the case of HTTP API calls, you’ll be able to sort them and see related hooks.

HTTP API calls

Finally, the Environment panel will give you PHP information including version and memory limit. You’ll also see database information, including server version, extension, and host. Information about the WordPress version you’re using and the server will be there, too.

Environment panel

Let’s Wrap It Up!

Working with WordPress can sometimes mean spending countless hours trying to figure out what’s making your website perform in a subpar way. Among the many tools you have at your disposal for finding the possible error, Query Monitor is one of the better ones. It provides you with tons of useful information but be warned – it doesn’t tell you what to do with it. That part you’ll have to figure out on your own.

Post your comment

Comments0