How to Hide the WordPress Admin Bar

How to Hide the WordPress Admin Bar

The ever-present WordPress admin bar at the top contains handy links for logged-in users to quickly access create screens, edit pages, reach settings, etc on the administrator screens.

The ever-present WordPress admin bar at the top contains handy links for logged-in users to quickly access create screens, edit pages, reach settings, etc on the administrator screens.

Its utility remains clear. However the persistent hovering bar proves visually distracting for roles focusing on site building and design rather than administration.

Thankfully, selectively disabling the bar for chosen user levels requires only minor edits.

While subscribers never view the toolbar, publishers may desire its removal as creating content shifts editing focus from tool consolidation to unimpeded immersion.

For non-technical owners, the dropdown shortcuts conveniently expedite common tasks.

Ultimately, the decision to disable the toolbar depends wholly on user roles and website management priorities rather than one-size-fits-all thinking.

As we will demonstrate, developers can discretely institute role-based admin bar preferences through additional functions code defining precise visibility rules.

Settings for the toolbar therefore need not follow blanket restrictions if implementers recognize its usefulness varies across users.

How to Hide the WordPress Admin Bar via the Dashboard

Hiding the WordPress admin bar can be easily done via the WordPress dashboard or backend or admin area, without the need for any coding.

The admin bar is the toolbar that appears at the top of the page when you are logged in to your WordPress site.

Here’s how you can hide it:

Log in to Your WordPress Dashboard

Go to your WordPress site and log in with your username and password.

Access Your Profile

Once logged in, navigate to the top right corner of the dashboard and click on your username or profile picture. This will take you to your profile page.

Alternatively, you can go to Users > Your Profile from the dashboard menu.

Find the Admin Bar Setting

On your profile page, scroll down until you see the “Toolbar” section.

Disable the Admin Bar

You will find a checkbox labeled “Show Toolbar when viewing site.” Uncheck this box to hide the admin bar.

Save Changes

After unchecking the box, scroll down to the bottom of the page and click the “Update Profile” button to save your changes.

Verify the Change

Once you’ve saved the changes, visit your site. The admin bar should no longer be visible on the top of your website when you are logged in.

Remember, this change is specific to your user account. It means the admin bar will still appear for other users based on their own profile settings.

If you want to globally hide the admin bar for all users, you would need to add some custom code to your theme’s functions.php file or use a plugin designed for this purpose.


How to Hide the WordPress Admin Bar Using a Plugin

To conveniently remove the WordPress admin bar for all users simultaneously, consider using a plugin. This approach eliminates the need to individually disable the admin bar in each user profile.

A widely recognized choice is the Hide Admin Bar plugin. Boasting over 40,000 active installations and a rating of 4.5 out of 5 stars on wordpress.org, its appeal lies in its simplicity.

Installation and activation are straightforward, with no additional setup required. Once activated, the admin bar will no longer be visible.

For a more tailored approach, the Hide Admin Bar Based on User Roles plugin is an excellent alternative. This plugin shines in its flexibility, allowing you to control visibility of the admin bar based on user roles.

Whether you aim to hide the admin bar from all users, just guests, or specific roles like authors, contributors, editors, or administrators, this plugin offers the necessary customization.

A recent update introduced a feature to show or hide the admin bar based on user capabilities, enhancing its versatility.

Upon installation, you’ll find a simple configuration section where you can specify your preferences for user roles and capabilities. After configuring your settings, simply click ‘Save Changes‘ to apply them.


How to Hide the WordPress Admin Bar with Code

Two effective code solutions exist for removing the admin bar depending on preference – total or role-based suppression. Even inexperienced users can safely add the snippets below into functions.php.

The singular difference becomes whether blanket hiding applies regardless of role versus selective visibility tied to user permissions.

For outright admin bar removal across user levels, implement the following universally applicable code addition:

This stripped down snippet indiscriminatory disables the toolbar by returning false to the associated rendering function. Without checks, universal effect takes place upon insertion.

Now to introduce selectivity so publishers lose but administrators retain the bar, this advanced tweak adds role logic:

/* Disable WordPress Admin Bar for all users */
add_filter( 'show_admin_bar', '__return_false' );

By wrapping toolbar logic in a function checking the user’s “editor” role first, developers and higher retain the bar while authors and below lose toolbar access. This granularity requires only minor additional lines while offering enhanced customization.

For selective visibility, use:

add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}

This verifies administrator access before displaying the toolbar. Non-admins subsequently lose the bar for a tailored effect based on user permissions rather than site-wide removal.

Conclusion

In summary, three straightforward methods exist for disabling the admin toolbar depending on needs – plugins if preferring simplicity over precision or custom code for advanced selectivity.

While a key asset for some, removing an unnecessary distraction empowers publishers to now fully immerse in creations devoid of hovering hindrances.

With tailored solutions in hand to conceal the bar for applicable roles rather than absolute removal, developers retain beneficial user freedoms to configure interfaces reflecting individual priorities.

And should the toolbar be missed thereafter or specific preferences evolve, a fewclicks or lines reverse course.

Ultimately through minor tweaks, we restored lost focus for those finding its lingering presence disruptive so creativity may continue unimpeded.

ExplainWP
The WordPress Learning Hub

Related Posts