Summery Summery
Re-apply the tail logic also applied on $items by wp_get_nav_menu_items().
Syntax Syntax
Parameters Parameters
- $items
-
(Required) An array of menu item post objects.
- $menu
-
(Required) The menu object.
- $args
-
(Required) An array of arguments used to retrieve menu item objects.
Return Return
(WP_Post[]) Array of menu item objects.
Source Source
File: wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
public static function sort_wp_get_nav_menu_items( $items, $menu, $args ) { // @todo We should probably re-apply some constraints imposed by $args. unset( $args['include'] ); // Remove invalid items only in front end. if ( ! is_admin() ) { $items = array_filter( $items, '_is_valid_nav_menu_item' ); } if ( ARRAY_A === $args['output'] ) { $items = wp_list_sort( $items, array( $args['output_key'] => 'ASC', ) ); $i = 1; foreach ( $items as $k => $item ) { $items[ $k ]->{$args['output_key']} = $i++; } } return $items; }
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.3.0 | Introduced. |