Skip to content

Commit

Permalink
Correctly apply current-menu-ancestor class to <li> in Nav block #67169
Browse files Browse the repository at this point in the history
Co-authored-by: getdave <[email protected]>
Co-authored-by: MaggieCabrera <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: mrwweb <[email protected]>
Co-authored-by: juanfra <[email protected]>
Co-authored-by: draganescu <[email protected]>
Co-authored-by: bph <[email protected]>
Co-authored-by: jordesign <[email protected]>
Co-authored-by: webmandesign <[email protected]>
  • Loading branch information
10 people authored Dec 2, 2024
1 parent fa10d2f commit 6561108
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation-submenu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {

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();
Expand Down

0 comments on commit 6561108

Please sign in to comment.