How to hide the WordPress admin bar for users

Cách tạo Button trên thanh Menu Wordpress cực kỳ đơn giản

To hide the WordPress admin bar from users, you can use a Plugin or manually add code to the functions.php file in your theme. By default, all logged-in users can see the admin bar, but you can hide it for specific user roles or for all users, including admins. This adjustment can improve user experience and make the interface more user-friendly. Using Plugins like Hide Admin Bar from Non-Admins can make the process easier and more efficient. Customizing the visibility of the admin bar can enhance the overall aesthetics and usability of your WordPress website for different user roles.

How to hide the WordPress admin bar from users – By default, all logged in users in WordPress, regardless of user role, will see the admin bar at the top of the page. The admin bar provides quick access to the admin area and editing tools for users with author roles and above.

However, users who register as members or contributors have limited access, so you can remove the admin bar or replace it with a more aesthetically pleasing alternative. This adjustment can enhance user experience and keep the interface more user-friendly.

Hide WordPress Admin Bar

Hiding the WordPress admin bar is relatively simple. You can use a Plugin to do it in the simplest way. However, if you do not use a Plugin, you can also refer to the following method. With just a small command, you can easily hide the WordPress admin bar.

Hide top admin bar is available on WordPress

See also  Call button for WordPress: Enhance user experience on your website.

By default, WordPress provides an option where you can hide the admin bar, but it requires you to go into each user profile to manually uncheck this option. This can become time-consuming if your website has many users.

To do this, you can go to the admin page then select Menu Member > All users. On the list of users, click “Edit”. Then you accumulate and discard attribute “Show toolbar when viewing the page” is okay.

Hide admin bar with code

If you have too many users, you can use code to quickly hide the admin bar.

Hide non-admin users

You can easily hide the admin bar from all non-admin users by adding custom code. This method simplifies the process and saves you from having to manually adjust settings for each user.

The simplest way is the code below to the file functions.php of your currently active theme by navigating to Interface > File editor (Theme File Editor) theme in the WordPress dashboard, paste it at the bottom.

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

Then click the button “Update File” (Update files) to apply the changes.

Hide admin bar for all users

If you want to hide the admin bar for all users, including admins and custom roles, you can use the code snippet below.

Copy the code into the file functions.php of your currently active theme by navigating to Interface > File editor (Theme File Editor) theme in the WordPress dashboard, paste it at the bottom.

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

Then click the button “Update File” (Update files) to apply the changes.

See also  Create a simple static site with Github Page

So, when you’re done, go to the homepage and check whether the admin bar test results have disappeared or not. If not, please clear the Cache.

Use Plugin to hide admin bar

If you don’t like using code, then you can use Plugin Hide Admin Bar from Non-Admins to hide the admin bar in WordPress quickly and effectively. You just need to install and activate the Plugin, and you can use the WordPress admin bar hiding feature.

WordPress hosting should I use?

Supplier Capacity CPU Lowest price* Register
Azdigi 6GB 2 55,0000 VND Link
Vietnix 2GB 1 56,000 VND Link

Conclude

With this guide, you can easily customize the visibility of your WordPress admin bar, tailoring the user experience to better suit the needs of different roles. This not only enhances the overall aesthetics and usability of your website but also helps the website function smoothly without adding unnecessary features.

Rate this post

Related posts