Opened 14 months ago
Last modified 14 months ago
#20289 new defect (bug)
wp_nav_menu container is not set when menu isn't defined
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Menus | Version: | 3.3 |
| Severity: | normal | Keywords: | has-patch needs-testing dev-feedback |
| Cc: | coenjacobs@… |
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)
Change History (3)
dannydehaan — 14 months ago
comment:1
CoenJacobs — 14 months ago
- Cc coenjacobs@… added
- Keywords dev-feedback added
Note: See
TracTickets for help on using
tickets.

Related: #13998, #18232, #13979, #18842