How to Remove the Admin Bar in WordPress

Do you want to remove the admin bar from WordPress? It is a very handy bar for admin accounts,  but it serves no purpose for those who cannot access it. In these cases, it may be better to remove the admin bar from their view, but you can also remove it for the admin as well.

The admin bar has a lot of features, which is why I recommend only removing it from non-admin accounts. Some of these features include plugin shortcuts, plugin activation and deactivation, start new posts, and more. Today, I will demonstrate how to remove the admin bar for all non-admin accounts as well as for all accounts.

Is it Normal to Remove the Admin Bar

It is absolutely normal to remove the admin bar for non-admin accounts. It serves no purpose for those accounts. However, it is not as common to remove it for all accounts (including administrators) because it is a very powerful tool. Since the admin bar can be accessed from anywhere, it saves administrators time.

For example, using the admin bar to activate and deactivate plugins can save you time. Normally you would need to go to Plugins and select the Installed Plugins option. You can then select which plugins to activate and deactivate, but you can now do that from anywhere on the website when using the admin bar.

How to Remove the Admin Bar in WordPress

Today, I will demonstrate how to remove the admin bar for all non-admin accounts as well as for all accounts. You will not need any additional plugins to complete this task. You will need access to your website’s cPanel. The login information is provided to you by your website hosting when you create an account with them.

Since you will be adding a line of code to your theme’s functions.php file, you should create a backup of your website. This will ensure that if anything goes wrong you can use the backup to revert your website to before the changes. This is extremely unlikely since this method is very easy to follow along.

Removing the Admin Bar

Let’s start by logging into the cPanel and clicking on the File Manager option. The File Manager will allow you to access all of the files related to your website.

Click on the File Manager option.

You need to locate your theme’s functions.php file. Click on the public_html directory, then click on the wp-content folder. Inside of this folder, you will find all of the content related to your website. Click on the themes folder and enter the folder of the theme you are currently using. Finally, right-click on the functions.php file and select the Edit option.

Select the "Edit" option.

A pop-up window will show up. This box will warn you to create a backup of your files before editing anything. This will ensure that you can revert your website back to when it was working if something goes wrong. Click on the “Edit” button. A new tab will open containing all of the code from the file.

Click on the "Edit" button.

You are now ready to paste a few lines of code. You have two options to choose from. The first is to remove the admin bar for all non-admin accounts and the second is to remove it for all accounts. You can change this at any time by changing the code you insert. Simply copy and paste the code under the option you want.

Option 1: All Non-Admin Accounts:[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]add_action(‘after_setup_theme’, ‘remove_admin_bar’);

function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {
show_admin_bar(false);
}
}[/ht_message]

Option 2: All Accounts:[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]show_admin_bar(false);[/ht_message]

Once you have inserted your choice of code into the functions.php file, click on the “Save Changes” button to finish.

Click on the "Save Changes" button.

Congratulations, you can now go back to your website and should not see the admin bar. Keep in mind that if you removed the bar for only non-admin accounts, you will need to use a non-admin account to see the changes. You can delete or replace this code at any time to add the admin bar back or change who can see it.

Hide Unnecessary Features

Keeping a website simple is important for both visitors and web developers. If someone does not need access to a certain part of your website, then make sure they do not see it, if possible. It is best to only show items that someone can interact with or has an immediate need for. This will reduce what they see and will make finding things easier and reduce page clutter.

Many websites make the mistake of creating pages that have too much content. These are known as busy pages and are a poor design choice. On the flip side, web developers will sometimes leave their backend open to all staff members. This is unnecessary and could potentially be a security risk.

Leave a Comment

Your email address will not be published. Required fields are marked *

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