Hide wordpress Admin Bar

Admin Bar hiding is very simple. Easily we can hide this using a Hook add_filter( ‘show_admin_bar’, ‘__return_false’ ).

function disable_admin_bar() {

add_filter( 'show_admin_bar', '__return_false' );
}
if ( ! is_admin()){
$uid=(int)get_current_user_id();
if($uid >1) add_action( 'init', 'disable_admin_bar', 1 );
}

These above code paste into function.php , There is a condition for admin user, if user is admin then it is showing, but other user can’t show the admin menu.

Leave a Reply

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

Result of *Captcha loading...