What Everybody Ought to Know about the WordPress Admin Bar

WordPress comes with an admin bar that displays handy shortcuts for logged in users.

This gives you quick access to admin tasks even when viewing your website’s front-end.

In this article, we will explain what is the WordPress admin bar, and how you can utilize or customize it to your own needs.

What is WordPress Admin Bar?

WordPress admin bar is a floating bar displayed for logged in users. It contains links to different admin screens, which allows logged in users to quickly switch to admin area when viewing the website.

The admin bar is displayed for all users inside the admin area. Individual users can hide the admin bar when viewing the website by editing their user profile.

The items displayed in the WordPress admin bar change based on user role and permissions. For example, users with administrator role see different items in the menu bar than users with editor role and so on.

Show or Hide Items in WordPress Admin Bar

Just like everything else in WordPress, the Admin bar is fully customizable via custom code or WordPress plugins. Some plugins already take advantage of this feature by adding their own menus in the admin bar.

To take control of the admin bar, first you will need to install and activate the Adminimize plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, go to Settings » Adminimize page and look for Admin Bar Backend Options and Admin Bar Front End Options tabs.

Clicking on each of them will take you to the admin bar options where you can select which items to display in WordPress admin bar. You can also choose items visible to each user role.

Don’t forget to click on ‘Update options’ button to save your changes.

Adminimize is a powerful plugin and allows you to change not just the admin bar but any admin screen on your WordPress site.

If you’re looking for an alternative, see our guide on how to hide unnecessary items from WordPress admin with the Admin Menu Editor plugin.

Add Custom Links to WordPress Admin Bar

The purpose of the WordPress admin bar is to provide quick shortcuts to different admin screens. You can further customize it by adding your own custom links to the admin bar.

For this, you will need to add custom code to your WordPress files. If you haven’t done this before, then take a look at our guide on how to copy and paste code in WordPress.

You need to add this code to your theme’s functions.php file, a site-specific plugin, or a code snippets plugin.

1234567891011121314// add a link to the WP Toolbarfunctionwpb_custom_toolbar_link($wp_admin_bar) {    $args= array(        'id'=> 'wpbeginner',        'title'=> 'Search WPBeginner',         'href'=> 'https://www.google.com:443/cse/publicurl?cx=014650714884974928014:oga60h37xim',         'meta'=> array(            'class'=> 'wpbeginner',             'title'=> 'Search WPBeginner Tutorials'            )    );    $wp_admin_bar->add_node($args);}add_action('admin_bar_menu', 'wpb_custom_toolbar_link', 999);

Hosted with ❤️ by WPCode

1-click Use in WordPress

In this code, we have added a link to Google that searches WPBeginner. You need to replace ID, title, and href values with your own.

We recommend adding this code in WordPress using the free WPCode plugin. It’s the safest and easiest way to add custom code in WordPress without editing your theme’s functions.php file.

To get started, you’ll need to install and activate the WPCode plugin. If you need help, see this tutorial on how to install a WordPress plugin.

Once WPCode is activated, head to Code Snippets » Add Snippet from your WordPress dashboard. Then, navigate to the ‘Add Your Custom Code (New Snippet)’ option and click the ‘Use Snippet’ button underneath it.

Next, you need to add a title for your snippet and paste the code snippet from above into the ‘Code Preview’ box.

Don’t forget to select ‘PHP Snippet’ as the code type from the dropdown menu on the right side of the screen.

Once that’s done, simply toggle the switch from ‘Inactive’ to ‘Active’ and click on the ‘Save Snippet’ button.

For more details, see our guide on how to easily add custom links to your WordPress admin bar.

Disable Admin Bar for All Users Except Administrators

Admin bar is highly useful for site administrators, editors, and authors. However, it is not very useful if you are running a WordPress membership website or just require users to login for certain tasks.

In that case, you may want to disable the admin bar for all users except site administrators. You will need to add the following code to your theme’s functions.php file, a site-specific plugin, or a code snippets plugin like WPCode.

1234567add_action('after_setup_theme', 'wpb_remove_admin_bar');  functionwpb_remove_admin_bar() {if(!current_user_can('administrator') && !is_admin()) {  show_admin_bar(false);}}

Hosted with ❤️ by WPCode

1-click Use in WordPress

For more details, see our article on how to disable WordPress admin bar for all users except administrators.

We hope this article helped you learn more about the WordPress admin bar. You may also want to see our ultimate step by step WordPress security guide to keep your WordPress admin area safe and secure or our recommendations of the best WordPress SEO plugins that you should use.

WordPress comes with an admin bar that displays handy shortcuts for logged in users. This gives you quick access to admin tasks even when viewing your website’s front-end. In this article, we will explain what is the WordPress admin bar, and how you can utilize or customize it to your…

WordPress comes with an admin bar that displays handy shortcuts for logged in users. This gives you quick access to admin tasks even when viewing your website’s front-end. In this article, we will explain what is the WordPress admin bar, and how you can utilize or customize it to your…

Leave a Reply

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