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

Props SergeyBiryukov.
Fixes #27735.


git-svn-id: https://develop.svn.wordpress.org/trunk@28836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-06-26 00:56:07 +00:00
parent b917e7998d
commit 7e9cf1d2c0

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 ] ) );
}