has_nav_menu
Filter HookDescription
Filters whether a nav menu is assigned to the specified location.Hook Information
File Location |
wp-includes/nav-menu.php
View on GitHub
|
Hook Type | Filter |
Line Number | 195 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$has_nav_menu
|
Whether there is a menu assigned to a location. |
string
|
$location
|
Menu location. |
Usage Examples
Basic Usage
<?php
// Hook into has_nav_menu
add_filter('has_nav_menu', 'my_custom_filter', 10, 2);
function my_custom_filter($has_nav_menu, $location) {
// Your custom filtering logic here
return $has_nav_menu;
}
Source Code Context
wp-includes/nav-menu.php:195
- How this hook is used in WordPress core
<?php
190 * @since 4.3.0
191 *
192 * @param bool $has_nav_menu Whether there is a menu assigned to a location.
193 * @param string $location Menu location.
194 */
195 return apply_filters( 'has_nav_menu', $has_nav_menu, $location );
196 }
197
198 /**
199 * Returns the name of a navigation menu.
200 *
PHP Documentation
<?php
/**
* Filters whether a nav menu is assigned to the specified location.
*
* @since 4.3.0
*
* @param bool $has_nav_menu Whether there is a menu assigned to a location.
* @param string $location Menu location.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/nav-menu.php
Related Hooks
Related hooks will be displayed here in future updates.