`return false` in `has_nav_menu()` if the `$location` does not exist in the `$_wp_registered_nav_menus` global.

Props SergeyBiryukov.
Fixes #27735.

Built from https://develop.svn.wordpress.org/trunk@28836


git-svn-id: http://core.svn.wordpress.org/trunk@28640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-26 00:57:15 +00:00
parent 0233933f22
commit 69b0077edf
1 changed files with 6 additions and 0 deletions

View File

@ -142,6 +142,12 @@ function get_nav_menu_locations() {
* @return bool Whether location has a menu.
*/
function has_nav_menu( $location ) {
global $_wp_registered_nav_menus;
if ( ! isset( $_wp_registered_nav_menus[ $location ] ) ) {
return false;
}
$locations = get_nav_menu_locations();
return ( ! empty( $locations[ $location ] ) );
}