WP_Admin_Bar::remove_menu( string $id )

Removes a node from the admin bar.


The menu slug to remove.


public function remove_menu( $id ) {
	$this->remove_node( $id );



User Contributed Notes

  1. Skip to note 2 content

    This page needs to show the admin bar menu item ids so that you can actually remove them.

    remove_menu uses remove_node to remove the menu. I found that after digging in the code. The Codex documentation page for remove_node, at https://codex.wordpress.org/Function_Reference/remove_node, has an example of its use and actually tells you how to find the menu ids. to wit:

    Finding Toolbar Node ID’s

    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”:

    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().

You must log in before being able to contribute a note or feedback.