How to Hide WordPress Admin Bar for Different Users

WordPress admin bar is a useful tool, but some web developers hide it to preserve the website design, some may also disable it to prevent other users from accessing the WordPress dashboard, here to know what are some ways to hide WordPress admin bar?

图片[1]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

How do I hide the admin bar for all users?

  • Using plug-ins

Hide Admin BarThe plugin removes all admin bars. Follow the steps below to activate:

  1. Open the WordPress admin page. In the sidebar, find "plug-in (software component)"→"Add New Plugin"
  2. Enter the name of the plug-inHide Admin Barand then press Enter.
  3. click (using a mouse or other pointing device)"Installation". Once the installation is complete, select"Activate."The
图片[2]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

From "In the installed plug-ins"FindHide Admin BarClick on "set up"You will then have the option to remove the admin bar for all users

图片[3]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

Auto Hide Admin BarThe plugin automatically hides the admin bar so that the WordPress toolbar disappears - and reappears when the mouse pointer is hovered over the top of the browser window, install and activate to use it.

图片[4]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应
  • Usage Code

Manually remove the admin bar by editing the site code. You can do this in a number of ways - by editing the WordPress theme file or adding theCustom CSS CodeThe

Below is the website theme by editing the .php fileto hide the toolbar steps:

1. Login to the WordPress admin page.

2. From WordPress Menuin, go to exterior condition → Theme File EditorThe

图片[5]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

3. In the right sidebar findTopic Papersand then clickfunctions.phpThe

图片[6]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

4. Scroll the mouse toend of pageand paste the following code snippet:

add_filter('show_admin_bar', '__return_false');

caveat

  • modifications functions.php When doing so, it's best to do it through a child theme so that your changes aren't lost when the theme is updated.
  • Make sure you back up your site before modifying the code in case something goes wrong.

5. ClickUpdated documentsSave after.

How to hide the admin bar for a specific user

If you don't want to hide the Admin Toolbar from everyone, disable it for specific users.

  • Use WordPress Admin Dashboard to Hide User-Specific Admin Bars

1. Login to WordPress dashboard and navigate to the sidebar"Users"→"All users".

图片[7]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

2. Locate the desired user. Hover your mouse over theUser profilesand then click below its nameeditorialThe

图片[8]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

3. In "personal option"Under the section, find "toolbar (in computer software)"option, then uncheck the "Show toolbar when viewing website"Box.

图片[9]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

4. Scroll to the bottom of the page and clickUpdating Personal InformationPerform confirmation.

How to hide specific userscharacterManagement columns of the

  • Use plug-ins to hide the admin bar for specific user roles

Some WordPress plugins allow you to hide the toolbar for certain user roles when you assign users to the same role:

1. In the WordPress sidebar"Users"→"All users".

2. Find the user and select"Edit."The

3. In"Name."Under the section, assign from the drop-down menu thecharacterThe

图片[10]-如何为不同用户隐藏 WordPress 管理栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

4. ClickUpdating Personal InformationAcknowledgment.

  • Use code to hide the admin bar for specific user roles

By adding the following to the WordPress site's functions.php file to add a code snippet to disable the admin bar for a specific role. You will need to use different codes depending on the role and purpose.

For example, to hide the admin bar for all users except those with administrative privileges:

1. On the WordPress sidebar → exterior condition → Theme file editor.

2. Go to"Theme paper"sidebar, and then click"functions.php".

3. Scroll to the bottom of the screen and paste the following code:

function hide_admin_bar_from_non_admins(){
    if (!current_user_can('administrator')) {
        add_filter('show_admin_bar', '__return_false');
    }
}
add_action('after_setup_theme', 'hide_admin_bar_from_non_admins'); }

4. ClickUpdated documentsSave after.

reach a verdict

Ways to hide the WordPress admin bar for all or specific users include:

  • utilization WordPress Admin Dashboardcompiler
  • Use plug-ins such asHide Admin BarmaybeAuto Hide Admin Bar
  • Internet censorshipThe functions.php of theAdd Code

Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
Author: xiesong
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments