This function removes an item from the Toolbar. Toolbar items are also called "nodes".
The Toolbar replaces the Admin Bar since WordPress Version 3.3.
note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks.
<?php $wp_admin_bar->remove_node( $id ); ?>
The node ID's can be found in the HTML source code of any WordPress page with a Toolbar on it. Find the list items that have ID's that start with "wp-admin-bar-". For example, the list item ID for the WordPress Logo on the left in the Toolbar is "wp-admin-bar-wp-logo":
<li id="wp-admin-bar-wp-logo" class="menupop"> … </li>
Remove "wp-admin-bar-" from the list item ID to get the node ID. From this example the node ID is "wp-logo".
Note: It's also possible to see all node ID's with this example from get_nodes().
Put this in your theme's functions.php file.
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 ); function remove_wp_logo( $wp_admin_bar ) { $wp_admin_bar->remove_node( 'wp-logo' ); }
remove_node() is located in wp-includes/class-wp-admin-bar.php
.