diff --git a/wp-includes/class-walker-nav-menu.php b/wp-includes/class-walker-nav-menu.php index e683a3d5c8..4683970c61 100644 --- a/wp-includes/class-walker-nav-menu.php +++ b/wp-includes/class-walker-nav-menu.php @@ -73,9 +73,27 @@ class Walker_Nav_Menu extends Walker { * @param int $depth Depth of menu item. Used for padding. */ $class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; - $output .= "{$n}{$indent}{$n}"; + $atts = array(); + $atts['class'] = ! empty( $class_names ) ? $class_names : ''; + + /** + * Filters the HTML attributes applied to a menu list element. + * + * @since 6.3.0 + * + * @param array $atts { + * The HTML attributes applied to the `