[wp-trac] [WordPress Trac] #62747: Bad behavior of wp_nav_menu

WordPress Trac noreply at wordpress.org
Sat Dec 28 15:32:32 UTC 2024


#62747: Bad behavior of wp_nav_menu
-----------------------------+------------------------------
 Reporter:  369work          |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Menus            |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:  has-screenshots  |     Focuses:
-----------------------------+------------------------------

Comment (by siliconforks):

 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.

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


More information about the wp-trac mailing list