From e70312845c379b1416eac19b30f1d6f21a7bf5ea Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Fri, 20 Jan 2023 16:06:21 +0800 Subject: [PATCH] move the check --- packages/block-library/src/navigation/index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 1d430b1af84c36..dcb98180b2a2cf 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -469,9 +469,7 @@ function block_core_navigation_get_fallback_blocks() { $fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks; } - if ( block_core_navigation_has_nested_core_navigation( $parsed_blocks ) ) { - return []; - } + /** * Filters the fallback experience for the Navigation block. @@ -646,6 +644,11 @@ function render_block_core_navigation( $attributes, $content, $block ) { $inner_blocks = new WP_Block_List( $fallback_blocks, $attributes ); } + $parsed_blocks = parse_blocks( $navigation_post->post_content ); + if ( block_core_navigation_has_nested_core_navigation( $parsed_blocks ) ) { + return ''; + } + /** * Filter navigation block $inner_blocks. * Allows modification of a navigation block menu items.