Black Bar

描述

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: debug, info, notice, warning, error, critical, alert, and emergency.

How do I use the Profiler?

To use the profiler, insert the following lines of PHP before and after the code you are profiling:

Before:

apply_filters('trace:start', 'Enter a description of what you are profiling here');

After:

apply_filters('trace:stop');

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:

add_filter('blackbar/enabled', 'is_user_logged_in');

评价

2023年2月4日
nice. thanks for updating. i prefer this extension for debugging.
2019年7月23日 1 回复
Thank you for giving new life to BlackBox Debug Bar! Not only the usefulness of this plugin, but the beautiful PHP coding leads me to write this review. I have learnt a lot from your code.
2019年1月19日
This plugin can make life easier when a quick debug is needed. I use it specially to inspect what my $_GET, $_POST, $_SESSION, $_COOKIES variables look like.
阅读所有7条评价

贡献者及开发者

“Black Bar” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

“Black Bar”插件已被翻译至1种本地话语言。 感谢所有译者为本插件所做的贡献。

将“Black Bar”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

4.0.1 (2023-03-04)

  • Added cache busting to enqueued assets
  • Added console level filter counts
  • Added HTTP_COOKIE value to INPUT_SERVER globals

4.0.0 (2023-02-13)

  • 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

See changelog for all versions.