wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
block_core_navigation_sort_menu_items_by_parent_id › WordPress Function
Desde5.9.0
Obsoleton/a
› block_core_navigation_sort_menu_items_by_parent_id ( $menu_items )
Parâmetros: |
|
Retorna: |
|
Definido em: |
|
Codex: |
Sorts a standard array of menu items into a nested structure keyed by the id of the parent menu.
Fonte
function block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) { $sorted_menu_items = array(); foreach ( (array) $menu_items as $menu_item ) { $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; } unset( $menu_items, $menu_item ); $menu_items_by_parent_id = array(); foreach ( $sorted_menu_items as $menu_item ) { $menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item; } return $menu_items_by_parent_id; } /** * Gets the inner blocks for the navigation block from the unstable location attribute. * * @since 6.5.0 * * @param array $attributes The block attributes. * @return WP_Block_List Returns the inner blocks for the navigation block. */