WP_Admin_Bar::add_group( array $args )
Add a group to a toolbar menu node.
Contents
Description Description
Groups can be used to organize toolbar items into distinct sections of a toolbar menu.
Parameters Parameters
- $args
-
(array) (Required) Array of arguments for adding a group.
- 'id'
(string) ID of the item. - 'parent'
(string) Optional. ID of the parent node. Default 'root'. - 'meta'
(array) Meta data for the group including the following keys: 'class', 'onclick', 'target', and 'title'.
- 'id'
More Information 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 global
object, 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 Source
File: wp-includes/class-wp-admin-bar.php
final public function add_group( $args ) { $args['group'] = true; $this->add_node( $args ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Adding a group to a parent node
This example adds a parent node, child nodes and a group to the toolbar.
Expand full source codeCollapse full source code
The output from this example in the toolbar will be: