admin-plugins author calendar category facebook post rss search twitter star star-half star-empty

Tidy Repo

The best & most reliable WordPress plugins

Free Debug Bar

Debug Bar

Plugin Author: WordPress.org

Jay Hoffmann

September 9, 2013 (modified on May 16, 2018)

Developer

As a developer, having access to debugging information can be invaluable when making tweaks to your code. Luckily, WordPress has great debugging options baked right into the software, but Debug Bar puts it all in one place.

What’s It Do?

Debug Bar places a new option on your admin bar labeled “Debug” which gives you troubleshooting information on any page on your site. You’ll be able to track PHP errors, SQL queries made on your page, calls to WP Query, info about your HTTP Request and Rewrite Info, and chunks of your Object Cache.

Debug Bar button

The Debug Bar in action

This plugin is for developers, and not meant for a production site. It’s perfect for testing your site locally or on a staging server, but if you weren’t following the list above, this plugin probably isn’t for you.

How’s It Work?

Before you even install and activate the plugin, you’ll want to make sure you set up your WordPress configuration correctly in order to enable all of Debug Bar’s functionality. In your wp-config.php file, find where it says

define('WP_DEBUG', false);

and replace it with

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', true);
define('SAVEQUERIES', true);

Here’s a walkthrough of what that all means.

  • define(‘WP_DEBUG’, true); enables PHP errors and notifications to be tracked on your site, which Debug Bar will list for you.
  • define(‘WP_DEBUG_DISPLAY’, false); disables the default Debug display, which will list errors at the top of your page. Since this will be displayed by Debug bar, you won’t need this.
  • define(‘SCRIPT_DEBUG’, true); tracks built-in Javascript and CSS errors as well. Optional.
  • define(‘SAVEQUERIES’, true); will track queries made on each page, and enable Debug Bar to list them.

You don’t need to use all of these options, but they will give Debug Bar full access to your site.

Once you have added these lines to your wp-config.php, save it, then install and activate Debug Bar. You’ll immediately see a new button added to the top right of your admin bar, labeled “Debug.”

Showing debug bar's SQL queries

Debug Bar “Queries” Screen

Visit any page on your site and click this button and a modal box will appear with a list of information on the page that you are on.

At the top global information for your site and server. Your server type, PHP and MySQL version, and the amount of Memory your WordPress install is using.

Notices / Warnings will display any PHP errors or notifications on the page. If there are any, then the Debug button will be orange. Otherwise, you will not see this tab. This will only work if WP_DEBUG is set to true.

PHP Notices & Warnings screen

The PHP Notices screening will only show if there is a problem

Queries will show a list of SQL queries made on that page. It will tell you what portion of your MySQL table is being referenced, and by which function and a PHP file.

WP Query shows information about calls to the WP Query object. It will give you details about your Loop parameters, object ID and which template is being used. If you are having trouble with a page not displaying the right content, then this is the tab to refer to.

WP Query Settings

The WP Query object

Request holds HTTP Request and Rewrite information. If pretty permalinks are set, you’ll see that rewrite rule in action and parsing information related to the WordPress rewrite engine (what goes in and what goes out).

Object Cache displays basic statistics related to your cache groupings. What is shown here will depend on what kind of caching mechanism you have set up if any.

The plugin works on both your sites back-end and front-end, and for each page. This will provide debugging information for your site. There are lots of ways to use, so I suggest exploring a few notable extensions to get started. You can also use it to do things like plugin benchmarking, so there’s plenty to explore.

Costs, Caveats, Etc.

Debug Bar is free to use and updated pretty often to keep it up to date with core developments. Because it’s a more developer-centric plugin it’s not the most directly supported plugin out there, but there is plenty of healthy discussion on the support forums.

The plugin developers also recommend you install the Debug Bar Console plugin to add a PHP/MySQL console to Debug Bar.

Resources

Plugin Info
  • Downloads: 1,512,146+
  • Downloads trend (30d): +157.4%
  • Active installations: 30,000+
  • Rating:
  • Last Update: March 15th, 2024
  • Download Plugin for Free