WP_Navigation_Fallback::get_nav_menu_with_primary_slug()private staticWP 6.3.0

Returns the classic menu with the slug primary if it exists.

Method of the class: WP_Navigation_Fallback{}

No Hooks.

Return

WP_Term|null. The classic nav menu with the slug primary or null.

Usage

$result = WP_Navigation_Fallback::get_nav_menu_with_primary_slug( $classic_nav_menus );
$classic_nav_menus(WP_Term[]) (required)
Array of classic nav menu term objects.

Changelog

Since 6.3.0 Introduced.

WP_Navigation_Fallback::get_nav_menu_with_primary_slug() code WP 6.6.2

private static function get_nav_menu_with_primary_slug( $classic_nav_menus ) {
	foreach ( $classic_nav_menus as $classic_nav_menu ) {
		if ( 'primary' === $classic_nav_menu->slug ) {
			return $classic_nav_menu;
		}
	}

	return null;
}