WP_Navigation_Fallback::get_nav_menu_at_primary_location(): WP_Term|null

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.

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

Return

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

Source

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;
}

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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