WP_Navigation_Fallback::get_nav_menu_at_primary_location()private staticWP 6.3.0

Gets the classic menu assigned to the primary navigation menu location if it exists.

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

Хуков нет.

Возвращает

WP_Term|null. The classic nav menu assigned to the primary location or null.

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

$result = WP_Navigation_Fallback::get_nav_menu_at_primary_location();

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

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

Код WP_Navigation_Fallback::get_nav_menu_at_primary_location() WP 6.6.2

private static function get_nav_menu_at_primary_location() {
	$locations = get_nav_menu_locations();

	if ( isset( $locations['primary'] ) ) {
		$primary_menu = wp_get_nav_menu_object( $locations['primary'] );

		if ( $primary_menu ) {
			return $primary_menu;
		}
	}

	return null;
}