in

How to Hide WordPress Admin Bar

Hide Admin Bar for a Specific User

If you’d wish to disable the admin bar for a selected user only, it’s very easy.

Navigate to the Users page and click on Edit for the specified user.

Inside the edit user screen, uncheck the ‘show Toolbar when viewing site’ box and click on update profile.

After saving the changes, this specific user won’t see the admin bar again.

There aren’t many reasons to disable the toolbar for less than one user. you’ll want to cover it instead for everybody or show it only to users of a particular role.

We can do this by employing a WordPress function or by employing a plugin. i will be able to show you both options. Let’s start by adding or editing functions that change the code.

Hide the Admin Bar Using a Function.php

The functions below will show you ways to disable the bar to all or any or any users or to all users but the administrator.

Make sure to stick these functions within the functions.php file of your child theme.

To access the functions file, navigate to Appearance -> Theme Editor and appearance for the functions.php file from the list on the proper.

Scroll to rock bottom of the file and paste your chosen desired function from below.

Disable the admin bar for all users.

To remove the admin bar for all users use this function:

show_admin_bar(false);

Disable the admin bar to all user roles except administrators

To hide the admin bar for all users besides the administrator role, use this function:

// Hide admin bar from subscribers
add_action(‘after_setup_theme’, ‘pfwp_remove_admin_bar’);
function pfwp_remove_admin_bar() {
if ( !in_array( ‘administrator’, (array) wp_get_current_user()->roles ) ) {
show_admin_bar(false);
}
}

Make sure to click on the Save Changes button after pasting the functions.

If you don’t wish to use functions and would like employing a plugin, follow the section below.

Hide the WordPress Admin Bar Using a Plugin

The first and therefore the easiest method to cover the WordPress admin bar is by employing a plugin.

First, navigate to Plugins -> Add New and look for Hide Admin Bar supported User Roles.

Click Install then Activate on the primary result on the left.

After activating the plugin, navigate to Settings -> Hide Admin Bar Settings.

The hide admin bar for all users option will disable the admin bar for all users including the administrator.

The hide admin bar for all guest users option will disable the admin bar for all users with the subscriber role.

All the opposite users, including the administrator and therefore the editor will keep seeing the bar.

In the third option, you’ll be ready to disable the admin bar to users supported their roles.

If for instance , you’d wish to hide the bar to all or any role users except the admin, author, editor, and contributor, confirm you check all boxes except theirs.

Whatever you chose, don’t forget to scroll to rock bottom of the page and click on on the Save Changes button.

Conclusion

The admin bar makes no sense for normal WordPress subscribers’ roles and may be easily hidden employing a function or a plugin.

Leave a Reply

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

SendinBlue VS GetResponse Review 2022: Comparison The Best Email Marketing Services