We all have WP_DEBUG enabled and use Debug Bar when developing WordPress plugins and themes, right? Here’s how I added my own panel.
class myDebugPanel {
function title() {
return 'My Debug';
}
function prerender() {}
function is_visible() {
return true;
}
function render() {
echo '<pre>Panel content....</pre>';
}
}
The class should be easy to understand, and don’t remove the prerender() method, it’s needed by Debug Bar when adding our panel.
Next, we’ll inject our new panel into Debug Bar panels collection, and we’re done.
function my_debug_panel_insert( $panels ) {
$panels[] = new myDebugPanel;
return $panels;
}
add_filter( 'debug_bar_panels', 'my_debug_panel_insert' );
