Opened 23 months ago
Closed 23 months ago
#56997 closed defect (bug) (duplicate)
Submenu class 'menu-item-has-children' stopped working
Reported by: | fpodhorsky | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.1 |
Component: | Menus | Keywords: | |
Focuses: | Cc: |
Description
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 // 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.
Change History (3)
#2
in reply to:
↑ 1
@
23 months ago
Replying to feverinlove:
I am also seeing this issue. It happends when "depth" attribute is set. Unsetting the depth attribute remediates the issue.
Yes, that's the solution for now. Good to hear that I am not the only one having this problem.
#3
@
23 months ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Severity changed from blocker to normal
- Status changed from new to closed
Hello @fpodhorsky, welcome to WordPress Trac!
Thanks for the report. There are already several reports about this topic. Please follow #56946 for the latest progress.
I am also seeing this issue. It happends when "depth" attribute is set. Unsetting the depth attribute remediates the issue.