Plugin API/Filter Reference/show admin bar


The show_admin_bar filter toggles the display status of the Toolbar for the front side of your website (you cannot turn off the toolbar on the WordPress dashboard anymore).

Note: The Admin Bar is replaced with the Toolbar since WordPress Version 3.3.

Example Usage

Note: The examples below should be called immediately upon plugin load or placed in theme's functions.php file.

This code would turn the display status of the Toolbar to off.

add_filter( 'show_admin_bar', '__return_false' );

Alternatively, you could write it into a full fledged function.

function my_function_admin_bar(){
	return false;
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

This would hide the Toolbar for all users except Administrators.

function my_function_admin_bar($content) {
	return ( current_user_can( 'administrator' ) ) ? $content : false;
add_filter( 'show_admin_bar' , 'my_function_admin_bar');