When your website means business.

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-&gt;add_menu([
		'parent' => false,
		'id'     => 'codepotent-debug-notifier',
		'title'  => $label
	]);
}
add_action('wp_before_admin_bar_render', 'codepotent_debug_notifier_register_admin_bar');
Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Cookies Notice