Opened 2 years ago
Closed 2 years ago
#16605 closed defect (bug) (invalid)
wp_nav_menu fallback_cb argument ignored with using menu argument
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Menus | Version: | 3.0.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
wp_nav_menu ignores the fallback_cb argument when also using the menu argument.
If this is the expected behavior, it should be documented as it isn't intuitive.
This fails to honor the fallback_cb -
wp_nav_menu(array('menu' => 'mymenu', 'container' => 'false', 'fallback_cb' => ''));
This works as expected -
wp_nav_menu(array('theme_location' => 'mylocation', 'container' => 'false', 'fallback_cb' => ''));
Change History (1)
comment:1
in reply to:
↑ description
filosofo — 2 years ago
- Keywords needs-patch 2nd-opinion removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

Replying to jonkirkman:
It is documented in the PHPDoc for wp_nav_menu. Is there somewhere else that it isn't documented correctly? (Codex has it, too.)
To elaborate, because you're specifying the menu, the only time the fallback_cb would apply is if that menu doesn't exist. In contrast, when you don't specify the menu, until one is assigned to that location the fallback_cb does apply.