[wp-trac] [WordPress Trac] #28642: wp_get_nav_menu_items retrieving empty array
WordPress Trac
noreply at wordpress.org
Thu Jun 26 09:14:28 UTC 2014
#28642: wp_get_nav_menu_items retrieving empty array
--------------------------+-----------------------------
Reporter: furi3r | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 3.9.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hi Guys, I found out this problem and it is a bit weird, I tried to debug,
but it looks everything on my side is correct, and is just the function
failing.
Environment:
WP_DEBUG on
PHP logs clear
WP latest
Situation:
I use a WP menu on the header. Every template calls to the_header() and
inside header.php I call to :
wp_nav_menu(array(
'theme_location' => 'main',
'container' => 'nav',
'menu' => 'main' ));
It works like a charm everywhere but in a specific archive of a custom
taxonomy (it works fine for others custom taxonomies).
Trying to debug I empty the full template and leave only the_header()
the_footer() to avoid conflicts, still happens the same.
I started to debug using other functions related:
In every archive I get the proper array with the menu in the last call,
but in the one failing i get:
var_dump(get_nav_menu_locations());
'''array(5) { ["primary"]=> int(122) ["bottom"]=> int(124) ["secondary"]=>
int(0) ["mobile-menu"]=> int(122) ["lang"]=> int(125) }'''
var_dump(is_nav_menu(122));
'''bool(true)
'''
var_dump(wp_get_nav_menu_items('main'));
'''array(0) { }
'''
Any ideas?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28642>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list