wpseek.com
A WordPress-centric search engine for devs and theme authors



block_core_navigation_block_contains_core_navigation › WordPress Function

Since6.2.0
Deprecatedn/a
block_core_navigation_block_contains_core_navigation ( $inner_blocks )
Parameters:
  • (WP_Block_List) $inner_blocks Inner block instance to be normalized.
    Required: Yes
Returns:
  • (bool) true if the navigation block contains a nested navigation block.
Defined at:
Codex:

Returns true if the navigation block contains a nested navigation block.



Source

function block_core_navigation_block_contains_core_navigation( $inner_blocks ) {
	foreach ( $inner_blocks as $block ) {
		if ( 'core/navigation' === $block->name ) {
			return true;
		}
		if ( $block->inner_blocks && block_core_navigation_block_contains_core_navigation( $block->inner_blocks ) ) {
			return true;
		}
	}

	return false;
}