WP_Navigation_Fallback::get_most_recently_created_nav_menu( WP_Term[] $classic_nav_menus ): WP_Term

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Sorts the classic menus and returns the most recently created one.

Parameters

$classic_nav_menusWP_Term[]required
Array of classic nav menu term objects.

Return

WP_Term The most recently created classic nav menu.

Source

private static function get_most_recently_created_nav_menu( $classic_nav_menus ) {
	usort(
		$classic_nav_menus,
		static function ( $a, $b ) {
			return $b->term_id - $a->term_id;
		}
	);

	return $classic_nav_menus[0];
}

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.