Make WordPress Core

Opened 13 years ago

Last modified 6 years ago

#20289 new defect (bug)

wp_nav_menu container is not set when menu isn't defined

Reported by: dannydehaan's profile dannydehaan Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Menus Keywords: dev-feedback needs-patch
Focuses: administration Cc:

Description

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'.

wp_nav_menu(
	array(
		'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 13 years ago.

Download all attachments as: .zip

Change History (5)

#1 @CoenJacobs
13 years ago

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

#3 @chriscct7
10 years ago

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

The patch for this was declined by Nacin in #13998

#4 @chriscct7
9 years ago

  • Focuses administration added
Note: See TracTickets for help on using tickets.