has_nav_menu
Filters whether a nav menu is assigned to the specified location.
Использование
add_filter( 'has_nav_menu', 'wp_kama_has_nav_menu_filter', 10, 2 );
/**
* Function for `has_nav_menu` filter-hook.
*
* @param bool $has_nav_menu Whether there is a menu assigned to a location.
* @param string $location Menu location.
*
* @return bool
*/
function wp_kama_has_nav_menu_filter( $has_nav_menu, $location ){
// filter...
return $has_nav_menu;
}
- $has_nav_menu(true|false)
- Whether there is a menu assigned to a location.
- $location(строка)
- Menu location.
Список изменений
| С версии 4.3.0 | Введена. |
Где вызывается хук
has_nav_menu
wp-includes/nav-menu.php 195
return apply_filters( 'has_nav_menu', $has_nav_menu, $location );