On this page
WP_Admin_Bar::add_group( array $args )
Adds a group to a toolbar menu node.
Description
Groups can be used to organize toolbar items into distinct sections of a toolbar menu.
Parameters
$argsarray Required-
Array of arguments for adding a group.
idstringID of the item.parentstringOptional. ID of the parent node. Default'root'.metaarrayMeta data for the group including the following keys:'class','onclick','target', and'title'.
More Information
- Toolbar items are also called “nodes”. Nodes can be parents for other nodes, which creates dropdown menus. When adding a group you’re actually adding a group node. Group nodes are not visible in the Toolbar, but nodes added to it are.
- This function is a method of the WP_Admin_Bar class and
$wp_admin_bar globalobject, which may not exist except during the ‘admin_bar_menu‘ or ‘wp_before_admin_bar_render‘ hooks. - The Toolbar replaces the Admin Bar since WordPress Version 3.3.
Source
File: wp-includes/class-wp-admin-bar.php. View all references
final public function add_group( $args ) {
$args['group'] = true;
$this->add_node( $args );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Admin_Bar::add_node() wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
Used By
| Used By | Description |
|---|---|
| wp_admin_bar_my_account_menu() wp-includes/admin-bar.php | Adds the “My Account” submenu items. |
| wp_admin_bar_my_sites_menu() wp-includes/admin-bar.php | Adds the “My Sites/[Site Name]” menu and all submenus. |
| wp_admin_bar_appearance_menu() wp-includes/admin-bar.php | Adds appearance submenu items to the “Site Name” menu. |
| wp_admin_bar_add_secondary_groups() wp-includes/admin-bar.php | Adds secondary menus. |
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_admin_bar/add_group