diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/blocks/categories.php --- a/wp/wp-includes/blocks/categories.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/blocks/categories.php Tue Sep 27 16:37:53 2022 +0200 @@ -23,12 +23,15 @@ 'show_count' => ! empty( $attributes['showPostCounts'] ), 'title_li' => '', ); + if ( ! empty( $attributes['showOnlyTopLevel'] ) && $attributes['showOnlyTopLevel'] ) { + $args['parent'] = 0; + } if ( ! empty( $attributes['displayAsDropdown'] ) ) { $id = 'wp-block-categories-' . $block_id; $args['id'] = $id; $args['show_option_none'] = __( 'Select Category' ); - $wrapper_markup = '
%2$s
'; + $wrapper_markup = '
%2$s
'; $items_markup = wp_dropdown_categories( $args ); $type = 'dropdown';