[wp-trac] [WordPress Trac] #28620: When $depth argument is used in wp_nav_menu last level menu items still have .menu-item-has-children class, even though they are not shown

WordPress Trac noreply at wordpress.org
Tue Oct 11 14:03:10 UTC 2022


#28620: When $depth argument is used in wp_nav_menu last level menu items still
have .menu-item-has-children class, even though they are not shown
-------------------------------------------------+-------------------------
 Reporter:  slobodanmanic                        |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  Menus                                |     Version:  3.7
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  good-first-bug has-patch has-unit-   |     Focuses:  ui
  tests commit                                   |
-------------------------------------------------+-------------------------
Changes (by audrasjb):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54478" 54478]:
 {{{
 #!CommitTicketReference repository="" revision="54478"
 Menus: Remove `.menu-item-has-children` on `wp_nav_menu` last level menu
 items when `$depth` arg is used.

 This changeset prevents `wp_nav_menu` last level menu items from having
 the `.menu-item-has-children` class when the `$depth` argument is used. It
 adds a loop in `wp_nav_menu()` to calculate the depth of each menu item
 with children to make sure the class is added only when applicable.

 Props slobodanmanic, kucrut, iCaspar, mdgl, petitphp, audrasjb, costdev.
 Fixes #28620.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/28620#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list