Sometimes you wish you had one of those new UltraFine 5K monitors and not because of their awesome color profile or sharp resolution, but for the whole 5120 pixel wide screen because many WordPress plugins have the horrible habit to insert a link in the admin bar to their settings panels.

Usually, this link is completely and utterly redundant, offers no [added] value whatsoever other than satisfying some narcissistic need for the plugin developer.

As such it is no surprise that many of those plugins don’t offer an option in their settings to remove their bookmark from your admin bar either.

It could always have been worse

Luckily with a simple code snippet we can solve much of this and remove items from the WP Admin Bar.

These are the IDs you’re looking for (click to enlarge)

First of all, you will need to find the ID for the items you wish to remove from the admin bar. A quick look at the source code, or in web inspector, will show the ID you’re looking for.

Once you have identified the ID of the item you wish to remove from the admin bar, we can proceed and craft our code snippet.

There are two possible methods here.

Method 1: Removing Nodes from the WordPress Admin Bar

The most common method to add items to the admin bar is the admin_bar_menu hook, which is part of the WP_Admin_Bar class.

Thus our code snippet will hook in with the admin_bar_menu hook and remove nodes with the remove_node function.

As usual, we recommend to use the excellent Code Snippets plugin by Shea Bunge, alternatively you can also add the following snippet to your functions.php.

function cleanBar_remove_adminbar_nodes($wp_admin_bar) {
add_action('admin_bar_menu', 'cleanBar_remove_adminbar_nodes', 999);
What does it do?

The snippet above creates a new function cleanBar_remove_adminbar_nodes which subsequently removes the WP logo (and its menu), the comments icon, the AMP plugin, and the theme options links from the admin bar shown earlier in this post. The function runs with a rather low priority (999) in order to make sure that all links already have added themselves to the menu before our removal code is triggered1.

You will have to replace those with the nodes you wish to remove, as identified earlier.

Method 2: Remove Menu from Admin Bar

The second option would be making use of remove_menu function and will hook into the wp_before_admin_bar_render hook, which is part of the $wp_admin_bar object.

We do this because some plugins mae use of this WP functionality, which allows to already modify the Admin Bar before it is even rendered.

Now our code would be as following2:

function cleanBar_remove_adminbar_menu() {
    global $wp_admin_bar;

add_action('wp_before_admin_bar_render', 'cleanBar_remove_adminbar_menu', 999);

3. There’s a Plugin for That

Sometimes the urge of plugin developers to not be forgotten and have their bookmark displayed at all times beats our tips and tricks and links will persevere, and survive, in your Admin Bar.

If all else fails, there’s a plugin for that.

This is WordPress we’re talking about after all.

The Adminimize plugin by Frank Bueltge offers many configuration to remove links from the admin bar, even based on user roles. The plugin also offers different features such as clean up the WordPress admin sidebar menu, which is often even worse a mess than the admin bar, change the behavior of specific items in the WP editor, control the availability of widgets and dashboard widgets. And all that user role based as well.

The free plugin is available from

  1. Hat tip Digging into WordPress
  2. Again don’t forget to replace the IDs used in the sample code with the IDs you wish to remove.