Codex tools: Log in
Contents |
WP_Admin_Bar is WordPress' class for generating the Toolbar that lines the top of of WordPress sites when signed in. This class can be hooked and modified to add or remove options that appear in the admin bar.
The Toolbar replaces the Admin Bar since WordPress Version 3.3.
note: Additional Toolbar functions are available outside the class for use in manipulating the $wp_admin_bar object. See /wp-includes/admin-bar.php or the Related section at the bottom of this article for more information.
The WP_Admin_Bar class is located in the file /wp-includes/class-wp-admin-bar.php
The following hooks are available for modifying this class:
Please note that these hooks have very limited use. In many cases, you will simply want to modify the $wp_admin_bar object. See usage below for more information.
This class is used internally by WordPress to create an object called $wp_admin_bar. Most modifications to WordPress' admin bar will generally be done by modifying the $wp_admin_bar object with the wp_before_admin_bar_render hook, and NOT necessarily through WP_Admin_Bar's internal hooks.
This can be used to add a node (such as a new menu) to the admin bar object. It accepts one array containing arguments.
This method can be used to remove any pre-defined node from the object. It accepts one argument, the id of the node to be removed.
Toolbar Methods: add_node(), remove_node(), add_group(), get_node(), get_nodes(),