WP/CP | Type: PHPDisplay Debugging status on Admin Bar

Code shared by CodePotent; goes in your theme functions file.

function codepotent_debug_notifier_register_admin_bar() {
   if (!current_user_can('manage_options')) {
      return;
   }
   global $wp_admin_bar;
   $label = esc_html__(' Debugging DISABLED ', 'codepotent-debug-notifier');
   if (defined('WP_DEBUG')) {
      if (WP_DEBUG == true) { // Loose comparison is intentional here.
         $label = '<div style="color: #f00;">'.esc_html__('  Debugging ENABLED  ', 'codepotent-debug-notifier').'</div>';
      }
   }
   $wp_admin_bar->add_menu([
      'parent' => false,
      'id' => 'codepotent-debug-notifier',
      'title' => $label
   ]);
}
add_action('wp_before_admin_bar_render', 'codepotent_debug_notifier_register_admin_bar');