Make WordPress Core

Opened 7 years ago

Last modified 8 weeks ago

#20289 reopened defect (bug)

wp_nav_menu container is not set when menu isn't defined

Reported by: dannydehaan Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3
Component: Menus Keywords: dev-feedback, needs-patch, bulk-reopened
Focuses: administration Cc:


When you use wp_nav_menu in your theme, but the actual menu isn't set via the backend menu interface, the container provided in the args is ignored and falls back to 'div'.

Attached diff always uses container provided in args, if 'div' or 'nav' is provided. If no container arg is provided, falls back to using 'div'.

		'theme_location' => 'main_menu',
		'container'      => 'nav',
		'menu_class'     => 'main-menu-navigation',

To test this: Use this function in your theme, without assigning a menu to this theme_location.

Attachments (1)

nav-menu-template.diff (1.4 KB) - added by dannydehaan 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @CoenJacobs
7 years ago

  • Cc coenjacobs@… added
  • Keywords dev-feedback added

#3 @chriscct7
5 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

The patch for this was declined by Nacin in #13998

#4 @chriscct7
3 years ago

  • Focuses administration added

#5 @iseulde
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#6 @JeffPaul
8 weeks ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.