David Ogilo

menu search

How to properly disable the admin bar in WordPress

I have read a lot of articles online about how to disable the new admin bar introduced in WordPress 3.1. From what I read, they have not been done the right way. The code below shows you how.

add_filter( 'show_admin_bar', 'site_show_admin_bar' );
 
function site_show_admin_bar( $show_admin_bar )
{
	if ( current_user_can( 'manage_options' ) )
		return true;
 
	return false;
}

The code above prevents the admin bar from being shown to non-admin users.

Tags: , , , ,

Old school browser detected!

Your browser is out of date, which means you can't use any of the site's required features. You can either upgrade your browser or switch to either Mozilla Firefox or Google Chrome