WordPress Debugging Guide

Written by Jean Galea
Written by Jean Galea

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.

Partner Sponsors


Full disclosure: 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. 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 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]


WordPress offers some excellent plugins which are aimed at developers more than normal users, and can be of tremendous help for debugging and optimising code.


WP-Crontrol lets you take control over what’s happening in the WP-Cron system.


Debug Objects

The Plugin Debug Objects provides the user, which has the appropriate rights, normally the administrator, a large number of information. Values and content get displayed at the frontend of the blog, to analyze errors but also to better understand WordPress.

The Plugin provides in various tabs information to:

  • PHP
  • Memory usage
  • Operating System
  • Server
  • WordPress Version
  • Language
  • Very extensive definitions of various constants
  • Cookie definitions
  • File Permissions
  • Separate user and usermeta tables
  • FTP and SSH definitions
  • Query information
  • Conditional tags; value of the tag
  • Theme information
  • Template Information
  • Cache content
  • Hooks and filters
  • Functions, which respond on hooks and filters
  • Contents of arrays to hooks and filters
  • All defined constants


Black Box

The BlackBox plugin adds a thin black bar to the top of any WordPress post or page, and provides quick access to errors, global variables, profile data, and SQL queries.



This Plugin integrates FirePHP in your WordPress installation and simplifies developing. No more vardump() and echo while debugging. FirePHP take care of it, clean and easy. WP-FirePHP simplifies this process, since it integrates FirePHP and provide diverse standards of PHP and WordPress. Including all constants, global variables and PHP standard global variables. Works only under PHP 5.


WP Developer Assistant

WP Developer Assistant is a WordPress plugin developed by a WordPress developer for WordPress developers.

  • Have you ever needed to run a query when you didn’t have access to phpMyAdmin or SSH?
  • Don’t you hate it when you need to upload a plugin, theme, or other file and don’t have FTP access?
  • Have you ever wondered where that action or filter hook gets called?
  • Want to enable errors while hiding them from everyone else?
  • Wouldn’t it be great if you could output a full listing of PHP global variable values on each page so debugging would be easier?
  • Ever wanted to modify one of those serialized options?
  • Would you like to quickly see a full list of defined constants?

It’s thoughts like these that caused me to make this plugin. WP Developer Assistant is the first WordPress plugin of its kind. It essentially is a toolkit that makes life as a WordPress developer easier.


  • Customizable enabling of PHP errors that only show for your user.
  • Display values of PHP’s built-in global variables (_POST, _REQUEST, _FILE, _ENV, etc) on each page.
  • Easily modify Options table values, including serialized data.
  • View a full list of all the add_action, do_action, add_filter, and apply_filters function calls complete with information on function names, priorities, number of accepted arguments, source file name, and file line number.
  • Quickly execute queries with the Run Query tool.
  • Show phpinfo().
  • View a comprehensive list of all the defined named constants, their current value, the declared value, the source file name of the definition, and the file line number of the definition.
  • Quickly and easily upload files to any place inside your WordPress installation. The uploader will even automatically extract archives to the destination directory.


Core Control

Core Control is mainly a Developers plugin, However it can be used by end users alike, Just realise, That novice users are not the initial target audience, and as such, this plugin (and its modules) may be more technical aimed.

Core Control is only supported on WordPress 2.9+, Due to this being aimed at debugging and developers, Only the latest stable release will be supported. It may work in older versions, but this is untested.

Core Control is a set of plugin modules which can be used to control certain aspects of the WordPress control. Currently, Core Control features modules for managing Filesystem Access, Managing plugin/theme/core updates, Managing HTTP Transports & External HTTP Request logging.


Cron View

This plugin lets you view the next cron jobs that are scheduled to run on your site. Very useful when debugging your site especially for plugins that rely on Cron, such as BackupBuddy.


P3 (Plugin Performance Profiler) 

This plugin creates a profile of your WordPress site’s plugins’ performance by measuring their impact on your site’s load time.  Often times, WordPress sites load slowly because of poorly configured plugins or because there are so many of them. By using the P3 plugin, you can narrow down anything causing slowness on your site.


WP Log Viewer

Add widget into Dashboard for view the day errors, view full log in page this plugin, configure the wp-config.php (optional) and add link to view errors in admin bar (optional)


Do you use any other tools? Let us know!

This article was filed in our , archives.
Written by 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.

In this article

Discover More

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 *

New discoveries, every week.
Join thousands of designers, developers, and builders that come to WP Mayor to find the best guides, tools, and services for their next website. One email, once a week.
WP Mayor Newsletter

Claim Your Free Website Tip 👇

Leave your name, email and website URL below to receive one actionable improvement tip tailored just 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.

What's missing?