[wp-trac] [WordPress Trac] #20289: wp_nav_menu container is not set when menu isn't defined

WordPress Trac noreply at wordpress.org
Thu Jul 3 12:00:04 UTC 2025


#20289: wp_nav_menu container is not set when menu isn't defined
--------------------------------------+-----------------------------
 Reporter:  dannydehaan               |       Owner:  (none)
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:
Component:  Menus                     |     Version:  3.3
 Severity:  normal                    |  Resolution:  wontfix
 Keywords:  dev-feedback needs-patch  |     Focuses:  administration
--------------------------------------+-----------------------------
Changes (by callumbw95):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 Hi All,

 I have just read through this ticket and caught myself up with the
 history. As discussed, the current behavior is by design. `wp_nav_menu` is
 intended to render defined navigation menus and their associated
 containers. When no menu is specified, it explicitly falls back to
 `wp_page_menu`, which is a distinct function designed for rendering a list
 of pages with its own container. Changing `wp_nav_menu` to output a
 container for `wp_page_menu` fallback would be a significant architectural
 alteration, potentially leading to other inconsistencies or unintended
 side effects, and goes against the distinct roles of these two functions.
 Themes requiring a consistent wrapper regardless of whether a menu is
 defined can implement this wrapping directly around the `wp_nav_menu` call
 in their templates.

 Because of the reasons mentioned and the extreme age of this ticket I have
 marked this ticket as `wontfix`, but please feel free to reopen the ticket
 and continue this discussion.

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


More information about the wp-trac mailing list