Hide Admin Bar for Users EXCEPT Administrators | WordPress Tutorial

by enablewebsitedesign


Hide Admin Bar for Users Except Administrators | WordPress Tutorial

The admin bar, or the admin menu, is a great feature that comes with WordPress. It allows users who have administrative permissions to quickly access administrative related functions right from the frontend of the website. However, WordPress sites may not need the admin bar enabled for all users, especially if it is a multi-user system.

In this tutorial, we will show you how to hide the admin bar for all users except administrators. This tutorial is for WordPress users running version 5.4 and above.


Before you begin, you should have:

    • WordPress 5.4 or higher installed


    • Admin access to your WordPress site


Step 1: Register a Theme Support

The first step is to register a theme support for the admin bar in the place of the theme’s function file. To do this, open your theme’s function file and add the following line of code:

add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );

This will register the theme support for the admin bar and also set its callback to __return_false. This will effectively disable the admin bar in the theme.

Step 2: Add a Filter

The next step is to add a filter for the admin bar. To do this, add the following line of code in the same theme’s function file:

add_filter( 'show_admin_bar', '__return_false' );

This filter will ensure that the admin bar is also disabled in the WordPress core as well. Once this is done, the admin bar will be completely invisible for all users except administrators.


In this tutorial, we showed you how to hide the admin bar for all users except administrators in WordPress 5.4 and above. The steps are easy to follow and should take only a few minutes to complete. We hope you find this tutorial helpful in managing access to the WordPress admin bar on your site.

Need a website for your business?

We offer affordable WordPress website design services that helps you create a powerful online presence. Our team of experienced designers has extensive knowledge of WordPress and can create a custom wordpress website design with elementor pro that perfectly reflects your brand and message. We will work closely with you to understand your needs and goals, and provide recommendations for design and functionality based on our expertise.

Get Website Design Services

In addition to design, we can also provide optimization services for search engines, responsive design for mobile devices, and integration with social media platforms. Our goal is to create a website that not only looks great, but also delivers results for your business or organization. Let us help you take your online presence to the next level with our professional WordPress website design services.

You may also like

Leave a Comment