[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
Mon Dec 19 00:00:06 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                                   |
-------------------------------------------------+-------------------------

Comment (by peterwilsoncc):

 In [changeset:"55005" 55005]:
 {{{
 #!CommitTicketReference repository="" revision="55005"
 Menus: Account for legacy calls to `nav_menu_css_class` filter.

 Modify `wp_nav_menu_remove_menu_item_has_children_class()` to account for
 changes to the `nav_menu_css_class` filter since it's introduction.

 The `$args` and `$depth` parameters were added after the filter's
 introduction so this protects against fatal errors in custom walkers
 applying the filter in a legacy format.

 Without the `$args` or `$depth` parameters,
 `wp_nav_menu_remove_menu_item_has_children_class()` no longer attempts to
 remove the `menu-item-has-children` from the lowest level menu items as
 these are required to determine the current branch the walker is walking.

 Follow up to [54999].

 Props dd32, azaozz, peterwilsoncc.
 See #56926, #28620.
 }}}

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


More information about the wp-trac mailing list