diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/blocks/navigation-submenu.php --- a/wp/wp-includes/blocks/navigation-submenu.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/blocks/navigation-submenu.php Fri Sep 05 18:52:52 2025 +0200 @@ -82,7 +82,6 @@ $font_sizes = block_core_navigation_submenu_build_css_font_sizes( $block->context ); $style_attribute = $font_sizes['inline_styles']; - $css_classes = trim( implode( ' ', $font_sizes['css_classes'] ) ); $has_submenu = count( $block->inner_blocks ) > 0; $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 ); @@ -99,11 +98,29 @@ $open_on_hover_and_click = isset( $block->context['openSubmenusOnClick'] ) && ! $block->context['openSubmenusOnClick'] && $show_submenu_indicators; + $classes = array( + 'wp-block-navigation-item', + ); + $classes = array_merge( + $classes, + $font_sizes['css_classes'] + ); + 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 ( $is_active ) { + $classes[] = 'current-menu-item'; + } + $wrapper_attributes = get_block_wrapper_attributes( array( - 'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) . - ( $open_on_click ? ' open-on-click' : '' ) . ( $open_on_hover_and_click ? ' open-on-hover-click' : '' ) . - ( $is_active ? ' current-menu-item' : '' ), + 'class' => implode( ' ', $classes ), 'style' => $style_attribute, ) ); @@ -159,7 +176,16 @@ $html .= '>'; // End appending HTML attributes to anchor tag. + $html .= ''; $html .= $label; + $html .= ''; + + // Add description if available. + if ( ! empty( $attributes['description'] ) ) { + $html .= ''; + $html .= wp_kses_post( $attributes['description'] ); + $html .= ''; + } $html .= ''; // End anchor tag content. @@ -180,6 +206,13 @@ $html .= ''; + // Add description if available. + if ( ! empty( $attributes['description'] ) ) { + $html .= ''; + $html .= wp_kses_post( $attributes['description'] ); + $html .= ''; + } + $html .= ''; $html .= '' . block_core_navigation_submenu_render_submenu_icon() . ''; @@ -222,7 +255,7 @@ if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) { $tag_processor = new WP_HTML_Tag_Processor( $html ); - while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item__content' ) ) ) { + while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item' ) ) ) { $tag_processor->add_class( 'current-menu-ancestor' ); } $html = $tag_processor->get_updated_html();