WP_Classic_To_Block_Menu_Converter::group_by_parent_id( array $menu_items ): array

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.

Returns an array of menu items grouped by the id of the parent menu item.

Parameters

$menu_itemsarrayrequired
An array of menu items.

Return

array

Source

private static function group_by_parent_id( $menu_items ) {
	$menu_items_by_parent_id = array();

	foreach ( $menu_items as $menu_item ) {
		$menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item;
	}

	return $menu_items_by_parent_id;
}

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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