Changeset 32746
- Timestamp:
- 06/13/2015 02:14:42 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/nav-menu.php
r32612 r32746 147 147 */ 148 148 function has_nav_menu( $location ) { 149 $has_nav_menu = false; 150 149 151 $registered_nav_menus = get_registered_nav_menus(); 150 if ( ! isset( $registered_nav_menus[ $location ] ) ) { 151 return false; 152 } 153 154 $locations = get_nav_menu_locations(); 155 return ( ! empty( $locations[ $location ] ) ); 152 if ( isset( $registered_nav_menus[ $location ] ) ) { 153 $locations = get_nav_menu_locations(); 154 $has_nav_menu = ! empty( $locations[ $location ] ); 155 } 156 157 /** 158 * Filter whether a nav menu is assigned to the specified location. 159 * 160 * @since 4.3.0 161 * 162 * @param bool $has_nav_menu Whether there is a menu assigned to a location. 163 * @param string $location Menu location. 164 */ 165 return apply_filters( 'has_nav_menu', $has_nav_menu, $location ); 156 166 } 157 167
Note: See TracChangeset
for help on using the changeset viewer.