How To Remove Admin Bar In WordPress: Plugin And Code Snippet Methods

Photo of author
Written By Charlie Giles

Devoted WordPress fan behind CodeCraftWP. Sharing years of web expertise to empower your WordPress journey!

Disclosure: This post may contain affiliate links, which means if you click on a link and make a purchase, I may earn a commission at no additional cost to you.

Want to remove the admin bar in WordPress? Follow our step-by-step guide using plugin or code snippet . We also share tips for specific user and page/post removal, as well as restoring the admin bar.

How to Remove Admin Bar in WordPress

If you’re a WordPress user, you’ve probably noticed the admin bar that appears at the top of your screen when you’re logged in. While this feature can be useful for quickly accessing certain areas of your site, it can also be distracting or unnecessary for some users. Fortunately, there are two easy ways to remove the admin bar in WordPress: using a plugin or using code snippets.

Using a Plugin

One of the simplest ways to remove the admin bar in WordPress is by using a plugin. This is a great option for users who aren’t comfortable editing code or who want a quick and easy solution.

Installing the Plugin

To use a plugin to remove the , you’ll need to install and activate a that’s designed for this purpose. One popular option is the “Remove Admin Bar” plugin, which is available for free in the WordPress plugin repository.

To install this , follow these steps:

  1. Log in to your WordPress dashboard
  2. Navigate to the “Plugins” section of the sidebar menu
  3. Click “Add New”
  4. In the search bar, type “Remove Admin Bar”
  5. Click “Install Now” on the plugin that appears
  6. Once the plugin is installed, click “Activate”

Configuring the Plugin

Once you’ve installed and activated the plugin, you can configure its settings to remove the admin bar. To do this, follow these steps:

  1. Navigate to “Settings” in the sidebar menu
  2. Click “Remove Admin Bar”
  3. Select the checkbox next to “Remove the admin bar for all users”
  4. Click “Save Changes”

Removing Admin Bar Using the Plugin

Once you’ve configured the plugin, the admin bar should be removed from your WordPress site. If you want to restore the admin bar at any time, simply return to the plugin settings and uncheck the “Remove the admin bar for all users” checkbox.

Using Code Snippets to Remove Admin Bar

If you prefer to customize your WordPress site using code, you can also remove the admin bar using code snippets. This method requires a bit more technical knowledge, but it can be a more flexible solution for advanced users.

Accessing the Functions.php File

To remove the admin bar using code snippets, you’ll need to edit the functions.php file in your WordPress theme. To access this file, follow these steps:

  1. Log in to your WordPress dashboard
  2. Navigate to “Appearance” in the sidebar menu
  3. Click “Theme Editor”
  4. Select your currently active theme from the dropdown menu
  5. Click “functions.php” in the list of files on the right-hand side

Adding Code Snippets to Remove Admin Bar

Once you’re in the functions.php file, you can add the code snippets that will remove the admin bar. Here are two different snippets you can use:

Option 1:

PHP

add_filter('show_admin_bar', '__return_false');

Option 2:

PHP

function remove_admin_bar() {
return false;
}
add_filter('show_admin_bar', 'remove_admin_bar');

Simply copy and paste one of these snippets into the bottom of the functions.php file, then save your changes.

Testing Code Snippets for Removing Admin Bar

After you’ve added the code snippets to your functions.php file, you’ll need to test them to make sure they’re working correctly. To do this, log out of your WordPress account and navigate to your site’s homepage. The admin bar should no longer be visible.

Conclusion

Removing the admin bar in WordPress can be a simple and effective way to customize your site’s appearance and functionality. Whether you prefer to use a plugin or code snippets, there are options available for users of all skill levels. With these , you can easily remove the admin bar and create a more streamlined and personalized WordPress experience.


Using a Plugin to Remove Admin Bar

Removing the admin bar in WordPress can be a tricky task, but using a plugin can make the process much simpler. There are a number of plugins available that can help you remove the admin bar with just a few clicks. In this section, we will discuss how to install, configure, and use a plugin to remove the admin bar in WordPress.

Installing the Plugin

The first step to using a plugin to remove the admin bar in WordPress is to find and install the right plugin. There are a number of plugins available in the WordPress repository that can help you remove the admin bar, so it’s important to choose the right one for your needs.

To install a plugin, go to your WordPress dashboard and click on “Plugins” in the left-hand menu. Then click on “Add New” at the top of the page. You can then search for the plugin you want to install by typing its name into the search box. Once you have found the plugin you want to install, click on “Install Now” and wait for the installation to complete.

Configuring the Plugin

Once you have installed the plugin, the next step is to configure it to remove the admin bar. Most plugins will have a settings page where you can configure the plugin to your liking.

To access the settings page for the , go to the “Plugins” section of your WordPress dashboard and click on the “Settings” link next to the plugin you have installed. This will take you to the settings page for the plugin.

On the settings page, you will usually find options for removing the admin bar. Depending on the plugin you have installed, you may be able to remove the admin bar for all users or only for specific users or user roles.

Removing Admin Bar Using the Plugin

Once you have configured the plugin to your liking, the final step is to use it to remove the admin bar in WordPress. Depending on the plugin you have installed, this may involve simply clicking a button or checking a box.

To remove the admin bar using the plugin, go to your WordPress dashboard and click on “Users” in the left-hand menu. Then click on “Your Profile” or the profile of the user you want to remove the admin bar for.

On the user profile page, you should see an option to remove the admin bar. Depending on the you have installed, this may be a checkbox or a button. Simply click the checkbox or button to remove the admin bar for that user.

Overall, using a plugin to remove the admin bar in WordPress is a quick and easy way to get rid of the . By following the steps outlined in this section, you should be able to find, install, configure, and use a plugin to remove the admin bar in no time.


Using Code Snippets to Remove Admin Bar

If you’re not a fan of using plugins, you can also remove the admin bar in WordPress using code snippets. This method requires a little bit of technical know-how, but it’s still relatively easy to do.

Accessing the Functions.php File

The first step in using code snippets to remove the admin bar is to access the functions.php file in your WordPress theme. This file is where you can add custom code to modify the behavior of your website.

To access the functions.php file, go to your WordPress dashboard and navigate to Appearance > Theme Editor. From there, select the functions.php file from the list of files on the right-hand side.

Before making any changes to the functions.php file, it’s a good idea to make a backup copy of the file just in case something goes wrong. You can do this by copying the code and pasting it into a text editor or by downloading a copy of the file to your computer.

Adding Code Snippets to Remove Admin Bar

Once you’ve accessed the functions.php file, you can add the code snippets to remove the admin bar. There are a few different code snippets you can use, depending on your needs.

To remove the admin bar for all users, add the following code to the functions.php file:

PHP

add_filter('show_admin_bar', '__return_false');

If you want to remove the admin bar for specific user roles, you can use the following code:

PHP

function remove_admin_bar_for_role(){
if ( !current_user_can( 'administrator' ) && !is_admin() ) {
show_admin_bar(false);
}
}
add_action( 'after_setup_theme', 'remove_admin_bar_for_role' );

In this code snippet, you can replace “administrator” with the user role that you want to remove the admin bar for.

Testing Code Snippets for Removing Admin Bar

After adding the code snippets to the functions.php file, it’s important to test them to make sure they’re working correctly. To do this, log out of your WordPress account and view your website as a visitor.

If the admin bar is still visible, there may be an error in your code. Double-check that you’ve added the code correctly and that there are no syntax errors.

If you’re still having trouble, you may want to consult with a WordPress developer or try using a plugin to remove the admin bar instead.

Overall, using code snippets to remove the in WordPress is a great option for those who prefer to avoid plugins. With a little bit of technical know-how and some simple code, you can customize the behavior of your website and improve the user experience for your visitors.


Additional Tips for Removing Admin Bar

Removing the admin bar in WordPress can be a great way to declutter your website and provide a better user experience. However, some users may still want to have access to the admin bar for certain functions. In this section, we will look at some additional tips for removing the admin bar for specific users, pages or posts, and restoring it if necessary.

Removing Admin Bar for Specific Users

If you have multiple users on your WordPress website, you may want to the admin bar for some users while keeping it for others. This can be easily achieved using a plugin called Adminimize. Here are the steps to the admin bar for specific users:

  1. Install and activate the Adminimize .
  2. Go to Users > All Users in your WordPress dashboard.
  3. Click on the user you want to remove the admin bar for.
  4. Scroll down to the Adminimize section and click on the Settings tab.
  5. Under the Toolbar section, uncheck the box next to “Show Toolbar when viewing site.”
  6. Click on the Update User button to save the changes.

You can repeat these steps for other users you want to remove the admin bar for.

Removing Admin Bar for Specific Pages or Posts

If you want to remove the admin bar for specific pages or posts on your website, you can do so using a code snippet. Here’s how:

  1. Go to the page or post where you want to remove the admin bar.
  2. Click on the Edit button to open the editor.
  3. Click on the Text tab to switch to the text editor.
  4. Add the following code snippet at the end of the file:

/ Remove admin bar on this page/post /
add_filter(‘show_admin_bar’, ‘__return_false’);

Click on the Update button to save the changes.

Now, the admin bar will not be visible when users view that particular page or post.

Restoring Admin Bar in WordPress

If you have removed the admin bar but want to restore it later, you can do so using a code snippet. Here’s how:

  1. Go to Appearance > Theme Editor in your WordPress dashboard.
  2. Click on the functions.php file to open it.
  3. Add the following code snippet at the end of the file:

/ Restore admin bar /
add_filter(‘show_admin_bar’, ‘__return_true’);

Click on the Update File button to save the changes.

Now, the admin bar will be visible again on your website.

In conclusion, removing the admin bar in WordPress can be a great way to improve the user experience on your website. By using the tips mentioned above, you can easily remove the admin bar for specific users, pages or posts, and restore it if necessary. Remember to always test your changes before implementing them on your live website.

Leave a Comment