[wp-trac] [WordPress Trac] #46042: wp_nav_menu always returns a container
WordPress Trac
noreply at wordpress.org
Sat Jan 19 20:20:35 UTC 2019
#46042: wp_nav_menu always returns a container
--------------------------+------------------------------
Reporter: thememason | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by thememason):
To reproduce the issue:
1. Setup a new WP install
2. Delete all pages
3. Use the following code somewhere in your theme
{{{
wp_nav_menu(array(
'theme_location' => 'top',
'container' => false
));
}}}
4. Inspect the results
The empty div appears to be coming from the callback wp_page_menu. The
only other solution I found is to use wp_count_posts('page') as well as
has_nav_menu. This still seems like a hack, I feel it should return false
instead of returning an empty div.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46042#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list