Black Bar is an unobtrusive Debug Bar for WordPress developers. It collects and displays errors, executed SQL queries, slow actions and hooks, theme templates, global variables, and provides a profiler.
How it helps you with development:
- Debug your code with the Console
- Inspect global variables (COOKIE, GET, POST, SERVER, SESSION, WP_Screen)
- Measure performance of your code with the Profiler
- View any PHP errors that occur when loading a page in the Console
- View executed MySQL queries along with execution time and backtrace
- View template files of the active theme in loaded order
- View the 50 slowest action and filter hooks along with callbacks ordered by priority
If you have never installed a WordPress plugin before, you can read instructions on how to do this here.
How do I add entries to the Console?
To add entries to the console, insert the following line of PHP anywhere in your code:
apply_filters('console', 'Enter something to debug here');
You can also add an optional log level like this:
apply_filters('console', 'Enter something to debug here', 'error');
The available log levels are:
How do I use the Profiler?
To use the profiler, insert the following lines of PHP before and after the code you are profiling:
apply_filters('trace:start', 'Enter a description of what you are profiling here');
How do I enable the plugin for non-administrators?
By default, Black Bar is only visible to administrator users. To enable it for all logged-in users, add the following code to your child theme’s functions.php file:
Contributors and Developers
“Black Bar” is open source software. The following people have contributed to this plugin.Contributors
- Fixed PHP 7 support
- Fixed console values which include HTML
- Added cache busting to enqueued assets
- Added console level filter counts
- Added HTTP_COOKIE value to INPUT_SERVER globals
- Added console level filters
- Added sorting to Action/Filter Hooks
- Added syntax highlighting to console entries
- Added trace information to SQL queries
- Beautified SQL formating
- Changed Profiler usage (use the “trace:start” and “trace:stop” hooks)
- Improved Profiler, it is now also more accurate
- Refreshed UI
- Requires PHP >= 7.3