Improve your debugging with Query Monitor on WordPress

This article has been written more than 1 years ago, information might old.

Every WordPress developer need to use a plugin and specific settings other the environment to develop.


To get information about the systems and about the code that is running in the page!

First you can use wp-config.php to enable specific options like:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
define( 'JETPACK_DEV_DEBUG', true );
define( 'JETPACK_STAGING_MODE', true );

The last part is for Jetpack to be helpful on debugging when is available, the first one I think that doesn’t require so much explanation.

The next step is a plugin and the best one is Query Monitor instead Debug Bar.

As you can see from the screenshot inside the plugin page on, that tool enable to you to see everything about what is running from Hooks to languages files loaded.

It is very helpful often to find when the hook is running or stacktrace of other hooks of different plugins or theme as example. Or to find the most slow query or if your css file is loaded.

The next step is to add few constants to improve the data that the plugin show to you.

define( 'QM_HIDE_CORE_HOOKS', true );
define( 'QM_HIDE_SELF', true );

With this 2 parameters the internal methods, hooks etc of WordPress are ignored and not showed (this parameter disabled is helpful when you are contributing on WordPress itself) and the second one ignore the data from the plugin Query Monitor itself.

Coming back to Debug Bar today is not developed anymore but is keep working of course but doesn’t show all this information without install to many plugins. At the same time Query Monitor support the Debug Bar plugins so as example you can use Debug Bar Shortcodes to see the shortcode available and what are the methods associated using Query Monitor.

The big issues of Query Monitor that has too many information so see them inside the same page can be not so comfortable.

For that reason I done a browser extension that show them inside the developer tools for Firefox and Chrome!

The next step is speed up the development so depends on your environment but I can suggest to you to use also Airplane Mode that disable external connections like for updates so your development site doesn’t get this kind of alerts.

As example I never got working xDebug so I use tail the error log where I print what I need to develop but is on your own to get the most from the tools that you want to use!

Liked it? Take a second to support Mte90 on Patreon!

Leave a Reply

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

Improve your debugging with Query Monitor on WordPress

time to read: 2 min