Blog Menu

Key highlights

  • Admin Bar Utility: Essential for administrators but potentially distracting for non-admin users.
  • Disabling for non-admins: Explains methods to disable the admin bar, improving the user interface and security.
  • Methods overview: Offers detailed instructions on using PHP code, plugins, and user settings to hide the admin bar.
  • Benefits: Streamlines the front end and enhances user experience by removing unnecessary access.
  • Customization tips: Highlights best practices for tailoring the dashboard to user roles for better security and efficiency.

Introduction

The WordPress admin bar is a valuable tool that offers quick access to essential features like the WordPress admin dashboard, theme settings and post-editing options.

It’s beneficial for administrators managing their WordPress website but can be an unnecessary distraction for non-admin users who don’t need these features.

Disabling the WordPress admin bar for all users except admins can help your site’s contributors and subscribers. They don’t need admin capabilities.

This comprehensive blog will explore various methods to hide or disable the admin bar, including PHP code, WordPress plugins and adjusting individual user settings.

Understanding the WordPress admin bar

The WordPress admin bar is a top toolbar that appears whenever users are logged into their WordPress site. This toolbar offers quick access to various parts of the admin dashboard, such as editing posts, managing plugins and viewing analytics.

The admin toolbar is invaluable for administrators because it provides easy access to backend settings. However, non-admin users, such as contributors or subscribers, rarely need to use these features, so many site owners hide admin bar for them.

The WordPress admin bar can distract non-admins, especially if they cannot access its available tools. It also adds clutter to the site’s front end, making the user experience less streamlined.

Disabling the admin toolbar for non-admins ensures a cleaner, more user-friendly interface for users only interacting with the site’s content.

However, the admin toolbar can also confuse users who are unfamiliar with the WordPress admin dashboard.

Thus, hiding it reduces the risk of accidental changes to your WordPress website.

Why hide the admin bar?

There are several compelling reasons to disable the WordPress admin bar for non-admin users.

First and foremost, the admin bar serves little to no purpose for users who don’t have administrative privileges.

For example, a subscriber on your site likely does not need to access the admin dashboard, so the admin toolbar becomes an unnecessary part of their user interface.

Another reason to hide the admin bar is to enhance the user experience for non-admin users. Without the admin toolbar, your site’s front end looks better. It is less cluttered. Users can then focus on the content, not the backend features.

This is crucial for sites that rely on user interaction, like forums and blogs. Users want to focus on content, not on managing the site.

Additionally, hiding the admin toolbar for non-admin users minimizes the chance of them accidentally altering your site’s settings or content.

For instance, if a contributor or editor clicks on specific admin bar options, they could inadvertently access features they don’t fully understand, leading to errors in your WordPress site’s configuration.

Disabling the admin bar for these users helps keep your site secure and well-managed.

Methods to hide the WordPress admin bar

You can choose from several methods to hide the WordPress admin bar for non-admin users.

Whether you prefer manual coding or a plugin-based solution, there’s a method that suits every user’s needs.

Using PHP code to hide the admin bar

For users comfortable with coding, adding a custom PHP code snippet to your theme’s functions.php file is one of the most effective ways to hide the WordPress admin bar.

This method gives you precise control over who can access the admin toolbar on your site.

Steps:

  1. Log into your admin dashboard and explore Appearance > Theme Editor.
  2. Locate the functions.php file of your active theme.
  3. Add the following PHP code snippet: if (!current_user_can(‘administrator’)) { add_filter(‘show_admin_bar’, ‘__return_false’); }
  4. Click Save Changes, and the admin bar will be hidden for all users except administrators.
Using PHP code to hide the admin bar

Using this method, only administrators with full access to the admin dashboard will see the admin bar.

Non-admin users, including editors, contributors and subscribers, will not know the admin toolbar when logged in.

This lightweight and efficient solution ensures your WordPress website remains fast and functional without additional plugins.

Using a plugin to disable the admin bar

Several WordPress plugins can help users who prefer a more user-friendly, non-coding solution easily disable the WordPress admin bar for non-admin users.

Plugins are great for those who want flexibility without manually editing theme files.

Recommended Plugins:

  • Hide Admin Bar based on user roles: This plugin allows you to hide admin bar based on specific user roles, such as subscribers or editors.
  • Adminimize: A powerful plugin that lets you control which features appear on the WordPress dashboard and admin toolbar for each user role.

Steps:

  1. Go to Plugins in your admin dashboard and click Add New.
  2. Search for the plugin of your choice (e.g., Hide Admin Bar Based on User Roles).
  3. Install and activate the plugin.
  4. Navigate to the plugin’s settings page to choose which user roles will not see the admin bar.
  5. Click Save Changes, and the WordPress admin bar will be hidden for the selected users.
Using a plugin to disable the admin bar

This method is perfect for site owners who want an easy-to-use interface without modifying code.

Additionally, these plugins often offer more granular control, such as hiding the admin toolbar for specific user roles while allowing others to see it.

Hiding the admin bar via user settings

WordPress also provides an option to manually disable the admin toolbar for individual users through their user profile settings.

This method is helpful if you hide admin bar for only a few users rather than disable it for all non-admins.

Steps:

  1. Log in to your admin dashboard and go to Users.
  2. Click on the user profile you want to modify.
  3. Scroll down to the Toolbar section.
  4. Uncheck the box labeled Show Toolbar when viewing the site.
  5. Click Save Changes, and the admin bar will be hidden for that specific user.
Hiding the admin bar via user settings

This method allows for manual customization on a per-user basis, making it ideal for small WordPress sites with limited users.

However, this method may not be the most efficient option if you have many users.

Configuring the admin bar for specific user roles

You can modify the WordPress admin bar visibility using custom PHP code to manage who sees the admin toolbar based on specific user roles.

This method is helpful when you want to show the admin toolbar for specific users (e.g., editors) but hide it for others (e.g., subscribers).

For instance, to hide the admin bar from all users except administrators and editors, use the following line of code:

if (!current_user_can('administrator') && !current_user_can('editor')) { add_filter('show_admin_bar', '__return_false'); }

This code ensures only administrators and editors can see the WordPress admin bar.

This is useful if your editors need access to specific admin dashboard tools while other users, like subscribers, should not know the admin toolbar.

You can combine this code with other methods to fine-tune the admin toolbar visibility across different user roles.

For instance, if you use a plugin like Adminimize, you can further control the features accessible within the admin dashboard for each user role.

Best practices for customizing the WordPress admin dashboard

Customizing the admin dashboard for non-admin users ensures a cleaner, more efficient interface on your WordPress website.

Tailoring the dashboard experience by hiding unnecessary features and limiting access to critical settings helps users focus on their tasks without distractions.

Here are some best practices to follow while using plugins or adding code snippets to customize your dashboard.

Simplify the interface for non-admin users

A cluttered admin dashboard can confuse non-admin users, making it harder for them to navigate.

Start by removing unnecessary widgets, menu items and tools non-admin users don’t need.

This can be done by manually editing the dashboard admin bar or through a WordPress plugin that allows customizations based on user roles.

Hiding the admin bar manually or removing specific options ensures that the user profiles are streamlined.

This simplifies the user experience and prevents accidental changes to critical settings on your live website.

Ensuring non-admin users see only the necessary tools helps maintain a cleaner and more user-friendly dashboard.

Limit access to sensitive settings

Non-admin users should not have access to change key settings like themes, plugins or other critical parts of the WordPress site. Limiting access is crucial for security and usability.

By adding code snippets to the functions.php file, you can restrict access to certain areas of the WordPress admin bar based on specific user roles.

For example, limiting access to the theme editor ensures that users without administrative privileges cannot alter the design of your live website.

Additionally, limiting access ensures only users with correct profiles can update or modify critical settings.

Restricting their access to tools they don’t need prevents unwanted errors that could disrupt the website.

Tailor dashboards based on user roles

Each user profile may have different responsibilities on your WordPress website, and it’s essential to customize the admin dashboard accordingly.

For instance, contributors and editors should see only tools for creating and editing content, while subscribers might only need access to user profiles.

You can achieve this by using a WordPress plugin or adding snippets to control what each role sees in the dashboard.

Customizing the WordPress admin bar using these techniques helps ensure that each user role has access to only what they need, creating a more focused experience.

For example, you can hide features such as the plugin and theme settings for non-admin users, reducing confusion and streamlining their interactions with the dashboard.

Using plugins to customize the admin Bar

Customizing the WordPress admin bar with plugins is one of the easiest ways to tailor the experience for different user roles.

Plugins allow you to hide specific elements of the admin bar, modify the WordPress dashboard or even hide the admin bar entirely for non-admin users.

With optimized performance and compatibility, these plugins simplify creating a more user-friendly experience without requiring manual coding.

With Bluehost, installing and managing WordPress plugins is simple. If you want to disable the WordPress admin bar or enhance your dashboard, we can help.

Manually customizing the admin bar with PHP Code

Manual customization with PHP code is a flexible option for developers who want more control over the admin toolbar.

Adding specific code snippets to your theme’s functions.php file allows you to hide or display certain parts of the admin toolbar for various users.

For instance, to remove the WordPress logo from the admin toolbar, you can use the following code snippet:

add_action('wp_before_admin_bar_render', 'remove_wp_logo');

function remove_wp_logo() {

global $wp_admin_bar;

$wp_admin_bar->remove_node('wp-logo'); // Removes the WordPress logo from the admin bar

}

This code allows you to remove specific items from the admin toolbar, providing a more customized experience for each user role.

Troubleshooting common issues

If you’re having trouble hiding the WordPress admin bar, there are several common issues to troubleshoot:

  • Clear cache: Cached pages may not show your recent changes. Clear your site’s cache to see the updated settings.
  • Check user roles: Ensure that users are assigned the correct user roles that either grant or restrict access to the admin toolbar.
  • Disable conflicting plugins: Sometimes, multiple plugins can conflict and prevent the admin toolbar from being hidden.

Addressing these issues ensures the WordPress admin bar is correctly hidden for non-admin users.

Final thoughts

Managing your WordPress website, especially customizing the WordPress dashboard and user roles, can feel complex.

Bluehost makes it easier with WordPress-optimized hosting that simplifies plugin management, custom code snippets and tailored WordPress admin bar configurations.

We also provide enhanced security, automatic updates and 24/7 customer support, ensuring your website runs smoothly and securely.

By choosing Bluehost, you’re getting a reliable partner. Ready to simplify your WordPress experience?

Explore Bluehost’s WordPress hosting plans today to take your website to the next level with powerful tools and support.

FAQs

How do I disable the admin bar for non admins in WordPress?

To disable the admin bar for non-admin users in WordPress, you can use a PHP file modification or a new plugin. The easiest way is to add the following code snippet to your theme’s functions.php file:
if (!current_user_can(‘administrator’)) {
add_filter(‘show_admin_bar’, ‘__return_false’);
}
Alternatively, you can install a helpful tool like a plugin to remove admin bar for non-admins automatically.

How do I hide the toolbar for all users in WordPress?

Hiding admin bar for all users by adding a CSS code snippet or using a plugin. To hide WordPress admin bar across your WordPress site, you can add the following code snippet to your theme:
#wpadminbar { display: none; }
For a more flexible solution, use a new plugin to customize the admin bar visibility based on roles.

How do I hide the WordPress admin bar for specific users?

To hide the WordPress admin bar for particular users, including logged-in users, you can use a helpful tool like a plugin or manually modify your theme’s functions.php file via the theme editor. This method helps you hide the WordPress admin bar without affecting administrators. You can also manage individual user settings by going to each user profile and selecting the update profile option. By adjusting user roles and permissions, you can hide the admin bar using either manual code or a plugin, keeping your website streamlined and user-friendly.

How do I get rid of the admin sidebar in WordPress?

To remove the admin sidebar in WordPress, modify your CSS code or use a WordPress plugin to hide the sidebar elements. This can be especially helpful when you want to simplify the viewing site experience for non-admin users. If you prefer a code-based solution, adding specific CSS code to your theme can help remove the sidebar without affecting the rest of the site’s functionality.

How can I change my profile settings so the WordPress admin bar is hidden from all users but administrators?

It makes sense to start by updating each user’s edit profile settings to disable the WordPress admin bar for all users except admins. You can update user permissions and uncheck the viewing site option for the admin bar. This can be a valuable tool for managing user roles without too many plugins. If you prefer automation, you can also use a bar using a plugin to disable admin bar for non-admin users quickly. This ensures the disable WordPress admin bar for all users is efficiently handled.

  • With a background in content writing, I thrive on turning complex concepts into relatable content. I focus on delivering clarity and creativity to help our brands stand out in the crowded digital realm.

Learn more about Bluehost Editorial Guidelines

Write A Comment

Up to 75% off on hosting for WordPress websites and online stores