• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

Display the top WordPress admin bar only to admin users

Find out in this tutorial how to hide the top WordPress admin bar for all users except administrators using code.

If you have a membership site or an intranet, you may prefer to prevent the WordPress admin bar from appearing when your users log in to their account.

However, when you log in with an administrator profile, you do need it to be visible for quick access to WP-admin.

So…

Do you want the WordPress admin bar to be displayed only to administrators and not to the rest of the logged in users?

I’m sure that what you’re going to learn today will come in handy.

Snippet to hide the top admin bar in WordPress except for admin users

Add the following code at the end of functions.php or in your functionality plugin:

To see this and another 839 code snippets of this website, login or subscribe here.

It’s that simple, see?

If you want to hide the admin bar for all users you also have a tutorial. 😉

Conclusion

With a few lines of code you can make it so that only users with admin privileges can see the admin bar.

Any questions? Let me know in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉

Header PHP WordPress

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?