Make WordPress Core

Ticket #47436: 47436.patch

File 47436.patch, 725 bytes (added by rishishah, 6 years ago)

Fix with tests

  • src/wp-includes/nav-menu-template.php

     
    189189                }
    190190        }
    191191
    192         // Add the menu-item-has-children class where applicable
    193         if ( $menu_items_with_children ) {
     192        // Add the menu-item-has-children class where applicable and depth of the menu set to default or greater than 1.
     193        if ( $menu_items_with_children && ( $args->depth > 1 || $args->depth == 0 ) ) {
    194194                foreach ( $sorted_menu_items as &$menu_item ) {
    195195                        if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) {
    196196                                $menu_item->classes[] = 'menu-item-has-children';