From 7e9cf1d2c01dbca12112b7988396ce24c84b77cc Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 26 Jun 2014 00:56:07 +0000 Subject: [PATCH] `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 --- src/wp-includes/nav-menu.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php index ee926ccfa4..782ecca89c 100644 --- a/src/wp-includes/nav-menu.php +++ b/src/wp-includes/nav-menu.php @@ -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 ] ) ); }