[wp-trac] [WordPress Trac] #56997: Submenu class 'menu-item-has-children' stopped working
WordPress Trac
noreply at wordpress.org
Fri Nov 4 10:41:02 UTC 2022
#56997: Submenu class 'menu-item-has-children' stopped working
--------------------------+-----------------------------
Reporter: fpodhorsky | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 6.1
Severity: blocker | Keywords:
Focuses: |
--------------------------+-----------------------------
Hello,
I don't know, maybe I am wrong, but when I updated to v6.1 I have noticed,
that submenu stopped working and the class 'menu-item-has-children' was
missing. So I started debugging and I found out that in wp-includes/nav-
menu-template.php - function wp_nav_menu() was weird if statement.
{{{#!php
<?php
// Add the menu-item-has-children class where applicable.
if ($menu_items_with_children) {
foreach ($sorted_menu_items as &$menu_item) {
if (
isset($menu_items_with_children[$menu_item->ID]) &&
($args->depth <= 0 ||
$menu_items_with_children[$menu_item->ID] < $args->depth)
) {
$menu_item->classes[] = 'menu-item-has-children';
}
}
}
}}}
The part where is "$args->depth <= 0" should probably look like this -
"$args->depth >= 0", because the argument depth must be higher or the same
as 0 to have submenu.
Thank you for checking and I am sorry if I am wrong.
Please, excuse my English.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56997>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list