`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:
parent
0233933f22
commit
69b0077edf
|
@ -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