Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#62747 closed defect (bug) (wontfix)

Bad behavior of wp_nav_menu

Reported by: 369work's profile 369work Owned by:
Milestone: Priority: normal
Severity: normal Version: trunk
Component: Menus Keywords: has-screenshots
Focuses: Cc:

Description

The menu of the theme that was displayed correctly up to 6.7.1 breaks down in 6.7.2.
I investigated the cause and found that in 6.7.2, wp_nav_menu is surrounded by a div by default. Until now, div was not supposed to be used unless a container was specified.

6.7.2-alpha-59547
theme original-theme(Theme in progress)

6.7.1 no problems

Attachments (3)

wp672-alpha-wpmenu.jpg (1.0 MB) - added by 369work 3 months ago.
wp671-wpmenu.jpg (729.0 KB) - added by 369work 3 months ago.
base_source_wpmenu.jpg (792.7 KB) - added by 369work 3 months ago.

Change History (6)

@369work
3 months ago

#1 @siliconforks
3 months ago

It looks like for 6.7.1, you have a menu assigned to your menu location, but in 6.7.2-alpha-59547, there is no menu assigned, so it is falling back to the value of fallback_cb which is wp_page_menu?

It is a known issue that the behavior of wp_page_menu is sometimes inconsistent with the behavior of wp_nav_menu. See: #18842, #14614, #13998.

I don't think anything changed for wp_nav_menu (or wp_page_menu) between 6.7.1 and 6.7.2-alpha-59547.

Personally I prefer to set fallback_cb to FALSE to avoid dealing with wp_page_menu entirely:

https://github.com/siliconforks/wordpress-examples/blob/513a2654f8420ef746d4ce8696f0450bb6f062e9/themes/example-minimal/header.php#L57-L71

You could also write your own custom fallback function.

#2 @369work
3 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

Thank you.
It appears that's the case.
This happened when I put a theme I was creating into a WP that had themeunitdata in it.
This was very helpful.
Thank you.

#3 @SergeyBiryukov
3 months ago

  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.