Removing the Help and Customiz’it admin bar buttons

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

Update : the Customiz’it button has been removed since v3.1.12 of the theme

 

Howdy developer!

Even if I have tried to style them as good as I could  :-?, some of you might be bothered by the help and customiz’it buttons in the top admin bar. Or may be you just don’t want your client to see them?

Anyway, here’s a quick snippet to get rid of those.

 

Where to copy/paste this code? Answer : in your functions.php file (of a Customizr child theme). The best way to customize a theme in WordPress is to create a child theme. Everything you need to know about child theme creation in Customizr here

 

add_action ('init' , 'remove_admin_bar_buttons');

function remove_admin_bar_buttons() {
	remove_action ( 'wp_before_admin_bar_render', array( TC_admin_init::$instance , 'tc_add_help_button' ));
}

 

Following @hugh comment, here’s an update of the callback function to remove those buttons for non-admin users only  :

function remove_admin_bar_buttons() {
	global $current_user;
	get_currentuserinfo();
	if ( in_array( 'administrator', $current_user -> roles ) )
		return;
    remove_action ( 'wp_before_admin_bar_render', array( TC_admin_init::$instance , 'tc_add_help_button' ));
}

 

And they are gone! Hope this helps you guys!

Leave a Reply to Denis Charron Cancel reply

Your email address will not be published. Required fields are marked *

10 thoughts on “Removing the Help and Customiz’it admin bar buttons”