Filter hook 'wp_navigation_should_create_fallback'

in WP Core File wp-includes/class-wp-navigation-fallback.php at line 79

View Source

wp_navigation_should_create_fallback

Filter Hook
Description
Filters whether or not a fallback should be created.

Hook Information

File Location wp-includes/class-wp-navigation-fallback.php View on GitHub
Hook Type Filter
Line Number 79

Hook Parameters

Type Name Description
bool $create Whether to create a fallback navigation menu. Default true.

Usage Examples

Basic Usage
<?php
// Hook into wp_navigation_should_create_fallback
add_filter('wp_navigation_should_create_fallback', 'my_custom_filter', 10, 1);

function my_custom_filter($create) {
    // Your custom filtering logic here
    return $create;
}

Source Code Context

wp-includes/class-wp-navigation-fallback.php:79 - How this hook is used in WordPress core
<?php
  74  		 *
  75  		 * @since 6.3.0
  76  		 *
  77  		 * @param bool $create Whether to create a fallback navigation menu. Default true.
  78  		 */
  79  		$should_create_fallback = apply_filters( 'wp_navigation_should_create_fallback', true );
  80  
  81  		$fallback = static::get_most_recently_published_navigation();
  82  
  83  		if ( $fallback || ! $should_create_fallback ) {
  84  			return $fallback;

PHP Documentation

<?php
/**
		 * Filters whether or not a fallback should be created.
		 *
		 * @since 6.3.0
		 *
		 * @param bool $create Whether to create a fallback navigation menu. Default true.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-navigation-fallback.php
Related Hooks

Related hooks will be displayed here in future updates.