10 WordPress Debugging Tools to Find Errors and Warnings

By | May 10, 2014

As a theme or plugin developer it is highly recommended that these developers must debug their code while working on it. Since they plan to release their products publicly, Debugging PHP code is part of any project. Thankfully WordPress comes with specific debug systems designed to simplify the debugging process as well as standardize code across the core, plugins and themes. This article describes the various debugging tools in WordPress and how to be more productive in your coding as well as increasing the overall quality and interoperativity of your code.

In-built WordPress Debug Tools :


It is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout WordPress. It is assumed to be false by default and is usually set to true in the wp-config.php file on development copies of WordPress.

define('WP_DEBUG', true);
define('WP_DEBUG', false);

Note: The true and false values in the example are boolean (true/false) values.

It is not recommended to use WP_DEBUG or the other debug tools on live sites; they are meant for local testing and staging installs.

Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed. This is likely to modify the default behavior of PHP which only displays fatal errors and/or shows a white screen of death when errors are reached.

Enabling WP_DEBUG will also cause notices about deprecated functions and arguments within WordPress that are being used on your site. Deprecation notices often indicate the new function that should be used instead.


It is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory. This is useful if you want to review all notices later or need to view notices generated off-screen (e.g. during an AJAX request or wp-cron run).

define('WP_DEBUG_LOG', true);


It is another companion to WP_DEBUG that controls whether debug messages are shown inside the HTML of pages or not. The default is ‘true’ which shows errors and warnings as they are generated. Setting this to false will hide all errors. This should be used in conjunction with WP_DEBUG_LOG so that errors can be reviewed later.

define('WP_DEBUG_DISPLAY', false);


It is a related constant that will force WordPress to use the “dev” versions of core CSS and Javascript files rather than the minified versions that are normally loaded. This is useful when you are testing modifications to any built-in .js or .css files. Default is false.

define('SCRIPT_DEBUG', true);


The SAVEQUERIES definition saves the database queries to an array and that array can be displayed to help analyze those queries. The constant defined as true causes each query to be saved, how long that query took to execute, and what function called it.

define('SAVEQUERIES', true);

The array is stored in the global $wpdb->queries.

NOTE: This will have a performance impact on your site, so make sure to turn this off when you aren’t debugging.

WordPress Debugging Plugins :

1. Debug Bar :

It adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.

2. Debug Bar Console :

It adds a PHP/MySQL console to the debug bar. Requires the debug bar plugin.

3. Log Deprecated Notices :

This plugin logs the usage of deprecated files, functions, and function arguments. It identifies where the deprecated functionality is being used and offers the alternative if available. This plugin also logs incorrect function usage, which WordPress started reporting in 3.1.

4. Total Security :

The Total Security plugin is the must-have tool when it comes security of your WordPress installation. The plugin monitors your website for security weaknesses that hackers might exploit and tells you how to easily fix them.

5. Query Monitor :

A WordPress plugin for monitoring database queries, hooks, conditionals, HTTP requests, query vars, environment, redirects including automatic AJAX debugging and more.

I hope you find this article helpful. If you have any query or suggestions to achieve the same result as above plugins does, do share with us.

Related Post