Hide WordPress Admin Toolbar to Logged in Users

You can hide the WordPress admin toolbar to logged in users based on their user role and capabilities. First of all you can hide the toolbar on all front end pages from all users by adding to your functions.php

add_filter( 'show_admin_bar', '__return_false' );

Lets say you wanted regular subscriber users not to see the toolbar when logged in your themes functions.php you can add …

if ( ! current_user_can( 'remove_users' ) ) {
 add_filter( 'show_admin_bar', '__return_false' );

The above is saying if the current user does not have the capability to remover users then don’t show the tool bar. A list of roles and user capabilities is found here.


Leave all Comment