The WordPress Admin Bar: What Everyone Should Know

WordPress includes an admin bar with useful shortcuts for logged-in users. Even when viewing your website’s front-end, you’ll have rapid access to admin activities. We’ll go over what the WP admin bar is and how you can use it or alter it to suit your needs in this article.

What you need to know about WordPress admin bar

What is the purpose of the WordPress Admin Bar?

The WordPress admin bar is a floating bar that appears when a user is signed in. It includes links to several admin screens, allowing logged-in users to swiftly transition to the admin section while browsing the site.

WordPress admin bar

Inside the admin section, the admin bar is visible to all users. Individual users can change their user profiles to conceal the admin bar when visiting the website.

Show or hide admin bar when viewing website

Depending on the user’s role and permissions, the things displayed in the WordPress admin bar alter. Users with the administrator job, for example, see different menu items in the menu bar than users with the editor role, and so on.

In the WordPress Admin Bar, you can show or hide items.

The Admin bar, like everything else in WordPress, may be completely customized using custom code or plugins. Some plugins already make use of this capability by adding their own admin bar menus.

Plugins adding their own items in admin bar

You must first install and activate the Adminimize plugin in order to take control of the admin bar. See our step-by-step guide on installing a WordPress plugin for more information.

Go to Settings » Adminimize and look for the Admin Bar Backend Options and Admin Bar Front End Options tabs after activation.

Admin bar options

When you click on any of them, you’ll be taken to the admin bar choices page, where you can choose which things to show in the WordPress admin bar. You can also choose which things each user role sees.

Show or hide items from WordPress admin bar

Remember to save your changes by clicking the ‘Update settings’ button.

Adminimize is a powerful plugin that allows you to customize any admin panel on your WordPress site, not simply the admin bar. See our guide on how to use Adminimize to conceal superfluous things from the WordPress admin for more information.

Customize the WordPress Admin Bar with Your Own Links

The WordPress admin bar’s aim is to allow rapid access to various admin panels. You can personalize it even more by adding unique links to the admin bar.

You’ll need to add custom code to your WordPress files to accomplish this. Take a look at our instruction on how to copy and paste code in WordPress if you haven’t done it before.

To begin, add this code to your theme’s functions.php file or a site-specific plugin’s functions.php file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// add a link to the WP Toolbar
function wpb_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);

We’ve included a link to Google that searches WPBeginner in this code. Replace the values for ID, title, and href with your own.

Adding custom link to WordPress admin bar

See our guide on how to simply add custom links to your WordPress admin bar for more information.

Except for administrators, disable the Admin Bar for all users.
For site administrators, editors, and authors, the admin bar is quite handy. However, if you’re running a WordPress membership site or simply need people to log in for particular tasks, it’s not really beneficial.

You could wish to disable the admin bar for all users except site administrators in that scenario. You’ll need to edit your theme’s functions.php file or use a site-specific plugin to add the following code.

1
2
3
4
5
6
7
add_action('after_setup_theme', 'wpb_remove_admin_bar');
 
function wpb_remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}

 

 

Post a Comment