How to Hide WordPress Admin Bar?

When users log in to a WordPress website, they should see a black bar at the top of the page. Referred to as the WordPress admin bar, it functions as a quick-access shortcut, providing access to various options.

Although the WordPress admin bar is a useful tool, numerous web developers choose to hide it to maintain the site’s design integrity. Others may disable it altogether to restrict access to the WordPress dashboard.

How to Hide the Admin Bar for All Users

Note: Before implementing any modifications, back up your WordPress website.
In case of errors, you can easily revert to a previous version using the backup file.

Using Plugin

Step 1. Login into your WordPress dashboard, then navigate to Plugins > Add New from the sidebar.

Step 2. Search for the Hide Admin Bar plugin.

Step 3. Click on Install. Once the installation completes, choose Activate.

Instead of disabling the top admin bar, you have the option to hide it with a WordPress plugin such as Auto Hide Admin Bar.

With this plugin, the toolbar will only become visible when you hover your cursor over the top area of the website.

Using Code

Step 1. Access your WordPress admin page.

Step 2. Navigate to Appearance > Theme File Editor from the WordPress menu.

Step 3. Locate the Theme Files section on the right side of your screen, then click on functions.php.

Step 4. Scroll to the bottom of the page and insert the following snippet.

add_filter(‘show_admin_bar’, ‘__return_false’);

Step 5. Click the Update File button to save the changes.

How to Hide the Admin Bar for a Specific User

If you don’t want to hide the admin toolbar for all users, you can disable it specifically for an individual user. This approach effectively restricts access to your site’s WordPress dashboard.

To hide the admin bar for a specific user, edit their profile through the WordPress admin dashboard:

Login to the WordPress dashboard, then go to the sidebar > Users > All users.

Step 1. Locate the desired user, hover over their profile, and select Edit below their name.

Step 2. In the Personal Options section, locate the Toolbar option and deselect the
Show Toolbar when viewing the site checkbox.

Step 3. Scroll to the bottom of the page and click Update Profile to save the changes.

What Is The Purpose Of The Admin Bar Being Cached?

Your Admin Bar will be cached if your integration meets the following criteria.

  • Full Site Integration Without WAF
  • After a page purge, an admin user logs in and sends the first request (after logging in) to CDN.
  • Specify CDN time limit for StackPath CDN caching

These conditions will allow your Origin to respond to the CDN’s request to cache content. The HTML file will reference the Admin Bar asset, and the CDN will override any no-cache header normally attached by your Origin to this page. The CDN will request the Admin Bar asset directly from your Origin and then place it in t
he cache. The cached request will be sent to the administrator logged in for any user who requests the same page again.

Avoid the Caching of the Administration Bar

You have two options to stop the caching of your admin bar.

  • This modifies WordPress settings so that the admin bar is not used on public pages.
  • The second will change your CDN settings to respect the correct Cache-Control headers from your Origin. Your Admin Bar will still function as before.

Conclusion

It is very easy to disable WordPress admin bars for all users, except the admin using RegistrationMagic.

The WordPress admin bar is hidden on all professional websites, whether online shops, blogs, or community sites. Only site builders can use the admin bar. It is not something your users will see when they visit your website. It also makes your site look unorganized and takes up space. Users love the neatness of clean and spacious sites. It is better to hide your admin bar from non-admins. This will make your site appear smarter.

The RegistrationMagic plugin takes care of all aspects of site appearance. It allows you to create a smart WordPress registration web page and an intelligent Contact Form for your site.

If you’re yet to start your WordPress site and looking for the best WordPress hosting, AccuWebHosting is the one-stop destination.

(Visited 527 times, 1 visits today)

Leave a Reply

AlphaOmega Captcha Classica  –  Enter Security Code
captcha      
 

This site uses Akismet to reduce spam. Learn how your comment data is processed.