WP_Admin_Bar::_render_group( object $node, string|bool $menu_title = false )
- Since
- 3.3.0, 6.5.0
- Source
wp-includes/class-wp-admin-bar.php:511
Compatibility
- WordPress
- since 6.5.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$nodeobject
Performance profile
How much work a call to WP_Admin_Bar::_render_group() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Light
- Scaling
- Scales with input
- Instructions
- 9–46
- Plugin surface
- None
- Called by
- 3
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 68.
Nothing here hands control to plugin code.
3 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()one call below WP_Admin_Bar::_render_group()
Further down the call graph this can also reach option, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 5 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Admin_Bar::_render_group() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 9–11 | none |
| always | 9 | ->_render_container() |
!empty($node) && empty($value) && empty($menu_title) | 33–34 | esc_attr() |
!empty($node) | 37–42 | esc_attr(), esc_attr() |
!empty($node) && !empty($value) && !empty($menu_title) | 45–46 | esc_attr(), esc_attr(), esc_attr() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 68 | 9–46 | 7 | |
| 8.5 | 68 | 9–46 | 7 | |
| 8.4 | 68 | 9–46 | 7 | 2 fewer instructions than PHP 8.3 |
| 8.3 | 70 | 9–48 | 7 | |
| 8.2 | 70 | 9–48 | 7 | |
| 8.1 | 70 | 9–48 | 7 | |
| 7.4 | 70 | 9–48 | 7 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 3
- esc_attr()Escaping for HTML attributes.
- WP_Admin_Bar::_render_container()
- WP_Admin_Bar::_render_item()
Used by · 3
Source code
final protected function _render_group( $node, $menu_title = false ) { if ( 'container' === $node->type ) { $this->_render_container( $node ); return; } if ( 'group' !== $node->type || empty( $node->children ) ) { return; } if ( ! empty( $node->meta['class'] ) ) { $class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"'; } else { $class = ''; } if ( empty( $menu_title ) ) { echo "<ul role='menu' id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$class>"; } else { echo "<ul role='menu' aria-label='" . esc_attr( $menu_title ) . "' id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$class>"; } foreach ( $node->children as $item ) { $this->_render_item( $item ); } echo '</ul>'; }Changelog
Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$menu_title parameter to allow an ARIA menu name.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/class-wp-admin-bar.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.