WordPress Debugging Guide

If you purchase through a link on our site, we may earn a commission. Learn more.

Did you know that WordPress provides a number of debugging tools for you? These are especially useful for theme and plugin developers. We can also find some plugins which can be helpful in debugging our WordPress code. In this post we take a look at WordPress in-built features as well as some great plugins for debugging.
Table of Contents
WP Engine High Performance Hosting
BionicWP Hosting

Did you know that WordPress provides several debugging tools for you? These are especially useful for theme and plugin developers. We can also find some plugins which can help debug our WordPress code. If you’re interested in monitoring tools please take a look at our review of WordPress monitoring plugins.

Let’s take a look at what WordPress provides as a standard first.

In-Built WordPress Debugging Features

The features below are all built into the WordPress standard installation and can be easily activated when needed.


WP_DEBUG is a WP constant that is found in the wp-config.php file. Once you define it in wp-config.php you’ll start seeing PHP notices and also WordPress-generated debug messages, particularly deprecated function usage. To activate this feature, open the wp-config.php file and enter the following at the end of the file:

[php]define(‘WP_DEBUG’, true);[/php]

There’s also WP_DEBUG_DISPLAY and WP_DEBUG_LOG, which enable you to log notices generated by WP_DEBUG to a wp-content/debug.log file.

WP_DEBUG should not be used on a live site.

WP_DEBUG will often reveal potential problems in your code, such as unchecked indexes (empty() and isset() are your friend) and undefined variables. (You may even find problems in WordPress itself, in which case you should file a bug report.)

You can also put the following code into your theme’s functions.php file to enable WP_DEBUG:

[php]if (!defined(‘WP_DEBUG’)) define(‘WP_DEBUG’, true);[/php]


The WordPress database class can be told to store query history:

[php]define( ‘SAVEQUERIES’, true );[/php]

When this is defined, $wpdb->queries stores an array of queries that were executed, along with the time it takes to execute them.
The database class has additional error and debugging tools, which are documented on the Codex (though when in doubt, check the source).


In the admin, WordPress minimizes and concatenates JavaScript and CSS. But WP also comes with the “development” scripts, in the form of dev.js and dev.css. To use these instead:

[php]define( ‘SCRIPT_DEBUG’, true );[/php]

WP Crontrol

WP Crontrol is a WordPress plugin designed to give you detailed control over your website’s WP-Cron system. It allows you to view, edit, add, and manage cron events and schedules, providing insights into scheduled tasks and their execution.

The plugin supports timezone awareness, alerts for misfiring events, and offers a privacy-focused approach, ensuring no data is sent to third parties. WP Crontrol is a valuable tool for developers and website administrators seeking to optimize and debug scheduled tasks within WordPress​​.

Activity Log

The Activity Log plugin for WordPress is a comprehensive solution for monitoring and tracking all activities on your WordPress site. It acts like a black box, recording every action in the WordPress admin area, allowing you to see what users are doing on your site in an activity log.

This plugin is especially useful for identifying unauthorized activities, tracking post publications, and monitoring plugin/theme changes. It’s designed to operate efficiently without affecting site performance and supports GDPR compliance by providing tools for data export and erasure.

Ideal for website administrators looking to secure their site and maintain an audit trail of user actions​​.

Do you use any other tools? Let us know!

Jean Galea

Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Discover more from our , archives ↓

Popular articles ↓

One Response

  1. Useful development tools. I especially like the Debug Objects. Black Box used to be my favorite, but I don’t like that debug messages are shown to non-admin users.

Share Your Thoughts

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

Claim Your Free Website Tip 👇

Leave your name, email and website URL below to receive one actionable improvement tip tailored for your website within the next 24 hours.

"They identified areas for improvement that we had not previously considered." - Elliot

By providing your information, you'll also be subscribing to our weekly newsletter packed with exclusive content and insights. You can unsubscribe at any time with just one click.