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:
parent
b917e7998d
commit
7e9cf1d2c0
@ -142,6 +142,12 @@ function get_nav_menu_locations() {
|
|||||||
* @return bool Whether location has a menu.
|
* @return bool Whether location has a menu.
|
||||||
*/
|
*/
|
||||||
function has_nav_menu( $location ) {
|
function has_nav_menu( $location ) {
|
||||||
|
global $_wp_registered_nav_menus;
|
||||||
|
|
||||||
|
if ( ! isset( $_wp_registered_nav_menus[ $location ] ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$locations = get_nav_menu_locations();
|
$locations = get_nav_menu_locations();
|
||||||
return ( ! empty( $locations[ $location ] ) );
|
return ( ! empty( $locations[ $location ] ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user