WP_Navigation_Fallback::get_fallback_classic_menu()private staticWP 6.3.0

Determines the most appropriate classic navigation menu to use as a fallback.

Метод класса: WP_Navigation_Fallback{}

Хуков нет.

Возвращает

WP_Term|null. The most appropriate classic navigation menu to use as a fallback.

Использование

$result = WP_Navigation_Fallback::get_fallback_classic_menu();

Список изменений

С версии 6.3.0 Введена.

Код WP_Navigation_Fallback::get_fallback_classic_menu() WP 6.6.2

private static function get_fallback_classic_menu() {
	$classic_nav_menus = wp_get_nav_menus();

	if ( ! $classic_nav_menus || is_wp_error( $classic_nav_menus ) ) {
		return null;
	}

	$nav_menu = static::get_nav_menu_at_primary_location();

	if ( $nav_menu ) {
		return $nav_menu;
	}

	$nav_menu = static::get_nav_menu_with_primary_slug( $classic_nav_menus );

	if ( $nav_menu ) {
		return $nav_menu;
	}

	return static::get_most_recently_created_nav_menu( $classic_nav_menus );
}