![图片[1]-如何隐藏 WordPress 工具栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024070902351319.png)
When logging into the WordPress dashboard, you will see a toolbar (admin bar) at the top that provides quick links and the ability to manage sections. However, this toolbar can seem redundant or even annoying when you want to view the user-friendliness of your website or page layout. In this article, we'll cover a few simple ways you can easily hide or disable the WordPress toolbar.
When to hide the toolbar
- Loss of administrator access: IfForgot Password, Security PluginLocking you out or plugin/theme issues that prevent access to the WordPress admin dashboard can be regained by hiding the toolbar.
- Broken WordPress: Encountering common WordPress incorrectWhen you do, you can help regain control by hiding the toolbar.
- security issue: If your website is hacked, you can protect it by hiding the toolbar.
Ways to hide the toolbar
1. Hiding toolbars through user settings
This is the easiest method for novice administrators:
- Log in to your WordPress dashboard.
- Open the "Users" section and select "personal profile".
- Under the "Toolbars" option, uncheck "Show toolbars when viewing websites".
![图片[2]-如何隐藏 WordPress 工具栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024070902284525.png)
This way, the toolbar will no longer be displayed when you are logged in as that user.
2. Hiding the toolbar with plug-ins
WordPress has a number of plugins that can help you customize various aspects of your website, some of whichplug-in (software component)You can hide the toolbar:
- Adminimize: This plugin allows you to customize which parts of the toolbar should be displayed based on user roles.
- Hide Admin Bar Based on User Roles: You can choose to hide toolbars for specific user roles, such as author, editor, etc.
3. Using code snippets to hide toolbars
If you know your way around the code, you can find it in the theme's functions.php
Add the following code snippet to the file:
![图片[3]-如何隐藏 WordPress 工具栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024070902312195.png)
- Disable the toolbar completely:
add_filter('show_admin_bar', '__return_false');
- Disable toolbars only for specific user roles (e.g. author):
add_filter('show_admin_bar', function($show) { if (current_user_can('author')) { return false; } return $show; });
caveat
- Avoid removing necessary features: Hiding the toolbar affects some shortcut operations, so make sure they don't interfere with your day-to-day administration.
- test code: Before adding the code to the
functions.php
Before you file, it is a good idea to test it in your development environment to make sure there are no errors.
![图片[4]-如何隐藏 WordPress 工具栏-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024070902575168.png)
summarize
The WordPress toolbar provides a lot of convenient shortcuts for website management, but in some cases, hiding it will allow you to better experience and manage your website. With user settings, plugins, or code snippets, you have the flexibility to customize theharbor (i.e. keep sth hidden)maybeprohibit the use of sth.Toolbar to improve the user experience and management efficiency of the website.
Link to this article:https://www.361sale.com/en/12983The article is copyrighted and must be reproduced with attribution.
No comments