wppaste
WordPress

render_block_core_navigation_submenu( array $attributes, string $content, WP_Block $block ): string

Since
5.9.0
Source
wp-includes/blocks/navigation-submenu.php:76
Renders the core/navigation-submenu block.

Compatibility

WordPress
since 5.9.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

$attributesarray
The block attributes.
$contentstring
The saved content.
$blockWP_Block
The parsed block.

Return value

string
Returns the post content with the legacy widget added.

Performance profile

How much work a call to render_block_core_navigation_submenu() 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
Heavy

Reaches the database via get_post().

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
91–215

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 339.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • querycontent queryget_post()one call below render_block_core_navigation_submenu()
  • hookthird-party callbacksapply_filters()one call below render_block_core_navigation_submenu()
  • optionoption read or writeget_option()one call below render_block_core_navigation_submenu()

Further down the call graph this can also reach cache, serialize 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 · 42 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost render_block_core_navigation_submenu() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes)91–112block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes)99–120block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), block_core_shared_navigation_render_submenu_icon()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes)99–118block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url)102–104block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf()
$block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes)102–121block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "always" && !isset($attributes)107–109block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), block_core_shared_navigation_render_submenu_icon()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url)110–112block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "always" && !isset($attributes)110block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), gutenberg_block_core_shared_navigation_render_submenu_icon()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url)124–128block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), esc_attr(), block_core_shared_navigation_render_submenu_icon()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url)124–126block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), esc_attr(), block_core_shared_navigation_render_submenu_icon()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url)127–129block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon()
$block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url)127block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon()
30 further outcomes, up to 215 instructions
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url)132–134block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), esc_attr(), block_core_shared_navigation_render_submenu_icon()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url)135block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$inner_blocks_html142–188block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && !$inner_blocks_html145–172block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_apply_colors_support(), class()
$block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$inner_blocks_html145–189block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "always" && !isset($attributes) && !$inner_blocks_html150–177block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && !$inner_blocks_html153–180block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && !$inner_blocks_html153–178block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_apply_colors_support(), class()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "always" && !isset($attributes) && !$inner_blocks_html153–178block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && $inner_blocks_html && !->next_tag()154–200block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()157–184block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
$block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && $inner_blocks_html && !->next_tag()157–201block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && !$inner_blocks_html161–186block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "always" && !isset($attributes) && $inner_blocks_html && !->next_tag()162–189block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()165–192block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()165–190block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "always" && !isset($attributes) && $inner_blocks_html && !->next_tag()165–190block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && !$inner_blocks_html167–196block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && !$inner_blocks_html167–194block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && !$inner_blocks_html170–197block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
$block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && !$inner_blocks_html170–195block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()173–198block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && !$inner_blocks_html175–202block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && !$inner_blocks_html178–203block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()179–208block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()179–206block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !isset($attributes) && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()182–209block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), wp_kses_post(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
$block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()182–207block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!defined('IS_GUTENBERG_PLUGIN') && !empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()187–214block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), esc_attr(), block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()
!empty($attributes) && $block && $value && !is_post_type_archive() && !isset($value) && $computed_visibility !== "hover" && $computed_visibility !== "click" && $computed_visibility !== "always" && !$attributes && empty($item_url) && $inner_blocks_html && !->next_tag()190–215block_core_shared_navigation_item_should_render(), is_post_type_archive(), block_core_navigation_submenu_get_submenu_visibility(), class(), __(), wp_strip_all_tags(), sprintf(), esc_attr(), wp_kses_post(), esc_attr(), gutenberg_block_core_shared_navigation_render_submenu_icon(), wp_apply_colors_support(), get_block_wrapper_attributes(), ->next_tag(), ->get_updated_html(), class()

This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev33991–21548
8.533991–21548
8.433991–2154812 fewer instructions than PHP 8.3
8.3351100–22748
8.2351100–22748
8.1351100–227481 fewer instruction than PHP 7.4
7.4352100–22748

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 · 15

Show all 15

Source code

function render_block_core_navigation_submenu( $attributes, $content, $block ) {	// Check if this navigation item should render based on post status.	if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {		$should_render = gutenberg_block_core_shared_navigation_item_should_render( $attributes, $block );	} else {		$should_render = block_core_shared_navigation_item_should_render( $attributes, $block );	}	if ( ! $should_render ) {		return '';	} 	// Don't render the block's subtree if it has no label.	if ( empty( $attributes['label'] ) ) {		return '';	} 	// Render inner blocks first to check if any menu items will actually display.	$inner_blocks_html = '';	foreach ( $block->inner_blocks as $inner_block ) {		$inner_blocks_html .= $inner_block->render();	}	$has_submenu = ! empty( trim( $inner_blocks_html ) ); 	$kind      = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] );	$is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind ); 	if ( is_post_type_archive() && ! empty( $attributes['url'] ) ) {		$queried_archive_link = get_post_type_archive_link( get_queried_object()->name );		if ( $attributes['url'] === $queried_archive_link ) {			$is_active = true;		}	} 	$show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'];	$computed_visibility     = block_core_navigation_submenu_get_submenu_visibility( $block->context );	$open_on_click           = 'click' === $computed_visibility;	$open_on_hover           = 'hover' === $computed_visibility;	$open_on_hover_and_click = $open_on_hover && $show_submenu_indicators; 	$classes = array(		'wp-block-navigation-item',	); 	if ( $has_submenu ) {		$classes[] = 'has-child';	}	if ( $open_on_click ) {		$classes[] = 'open-on-click';	}	if ( $open_on_hover_and_click ) {		$classes[] = 'open-on-hover-click';	}	if ( 'always' === $computed_visibility ) {		$classes[] = 'open-always';	}	if ( $is_active ) {		$classes[] = 'current-menu-item';	} 	$wrapper_attributes = get_block_wrapper_attributes(		array(			'class' => implode( ' ', $classes ),		)	); 	$label = ''; 	if ( isset( $attributes['label'] ) ) {		$label .= wp_kses_post( $attributes['label'] );	} 	$aria_label = sprintf(		/* translators: Accessibility text. %s: Parent page title. */		__( '%s submenu' ),		wp_strip_all_tags( $label )	); 	$html = '<li ' . $wrapper_attributes . '>'; 	// If Submenus open on hover or are always open, we render an anchor tag with attributes.

Changelog

Introduced in 5.9.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/blocks/navigation-submenu.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.