WP_Admin_Bar::remove_menu( string $id )
Remove a node from the admin bar.
Parameters Parameters
- $id
-
(string) (Required) The menu slug to remove.
Source Source
File: wp-includes/class-wp-admin-bar.php
public function remove_menu( $id ) { $this->remove_node( $id ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
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().