Do you find it annoying when your admin toolbar was loaded with too much menu items? These menu items are quick links so you can easily navigate on them. But if you don’t use it frequently, it would be better to remove them from the toolbar. While some plugins comes with settings where you can disable it’s menu link from the admin toolbar, others do not have. So it is better to check plugin settings first before executing extra code.

Once you are sure that there is no option available from the plugin’s settings, you can go ahead with the guide below to remove or disable menu link from the admin toolbar.

WP Admin Toolbar Menu Items

First Step

We need to get the “ID” of the Toolbar item/link that we would like to remove. While logged to your WordPress Dashboard, inspect element of the Tootlbar item/link. Below is a screenshot for easier visualization.

Google Chrome Inspecting An Element

As shown in the screenshot, the node ID attribute is “wp-admin-bar-updraft_admin_node”, where “wp-admin-bar” is a prefix and the node we need to disable is “updraft_admin_node”.

<li id="wp-admin-bar-updraft_admin_node" class="menupop">...</li>

Copy the node ID part to your clipboard. We are going to use this in the next step.

Second Step

This is the function I used and added in my theme’s function.php

//disable WP admin toolbar menu items
 //Lucena Digital Space
 //https://www.michaelcastrillo.com/disable-menu-link-from-admin-toolbar/
 function custom_remove_toolbar_menu() {
	global $wp_admin_bar;
	$wp_admin_bar->remove_menu('updraft_admin_node'); // disable toolbar link Updraft
	}
 add_action('wp_before_admin_bar_render', 'custom_remove_toolbar_menu', 999); 

To make sure the item is remove from toolbar, set priority to 999. The higher priority parameter, the later the action execute.

Updraft Tips

On your wp-config file, you can use this code to disable Updraft Menu item on the admin toolbar.

define('UPDRAFTPLUS_ADMINBAR_DISABLE', true);

With this technique, even you change your theme, Updraft Menu item will remain disabled. The first method and this technique will both work, so you decide whichever you think is the best for you.

Bonus!

If you want to remove multiple menu items, you can use the code below for your guide.

//disable WP admin toolbar menu items
 //Lucena Digital Space
 function custom_remove_toolbar_menu() {
	global $wp_admin_bar;	
	$wp_admin_bar->remove_menu('updraft_admin_node');
	$wp_admin_bar->remove_menu('w3tc');
	$wp_admin_bar->remove_menu('comments');
	$wp_admin_bar->remove_menu('customize');
	}
 add_action('wp_before_admin_bar_render', 'custom_remove_toolbar_menu', 999); 

Some others might hide those menu items using CSS, but in our examples above, we hooked into admin_bar_menu.

For sure, there are other things I missed, but I tried to make it as simple as possible. Thank you for reading my article!

Author

In 2010, Michael started his online career. With no formal education and training in Website Design and Development, his passion drives him to learn more using free online resources.

Write A Comment