#23508 closed defect (bug) (fixed)
Nav Menu Saving: get_nav_menu_locations() can return false, code expects array
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Menus | Version: | trunk |
| Severity: | normal | Keywords: | has-patch 3.6-menus needs-codex |
| Cc: | jkudish |
Description
get_nav_menu_locations() can return false (it is right now with Twenty Thirteen) but /wp-admin/nav-menu.php tries to always treat it as an array:
https://core.trac.wordpress.org/browser/trunk/wp-admin/nav-menus.php?rev=23441#L277
This throws a warning and breaks stuff.
Attachments (3)
Change History (14)
comment:1
SergeyBiryukov — 3 months ago
- Keywords needs-patch removed
- Milestone changed from Awaiting Review to 3.6
comment:2
SergeyBiryukov — 3 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 23453:
- Resolution fixed deleted
- Status changed from closed to reopened
I think get_nav_menu_locations() should always return an array, as the docs say. Let's try to also fix that?
comment:4
SergeyBiryukov — 3 months ago
- Keywords needs-patch added
JustinSainton — 3 months ago
comment:5
JustinSainton — 3 months ago
Ensures that get_nav_menu_locations() always returns an array.
SergeyBiryukov — 3 months ago
comment:6
DrewAPicture — 3 months ago
- Keywords has-patch 3.6-menus added; needs-patch removed
- Version set to trunk
SergeyBiryukov — 3 months ago
comment:8
DrewAPicture — 3 months ago
23508.3.diff works for me.
comment:9
SergeyBiryukov — 3 months ago
Not sure if we need the ! empty() check, is_array() seems enough (23508.2.diff).
comment:10
SergeyBiryukov — 3 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In 23550:
comment:11
DrewAPicture — 2 months ago
- Keywords needs-codex added
Note: See
TracTickets for help on using
tickets.

ticket:23119:23119.4.diff would fix it, see ticket:23119:224.