Make WordPress Core

Opened 4 years ago

Last modified 14 months ago

#15533 reopened defect (bug)

wp_get_nav_menu_items order doesn't work — at Version 1

Reported by: markoheijnen Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 3.0
Component: Menus Keywords: 2nd-opinion
Focuses: Cc:

Description (last modified by scribu)

Argument order doesn't work when output is ARRAY_A since on the end of function wp_get_nav_menu_items there is a usort on the $items array what will be returned.

Since out ARRAY_A is the default output this can give strange behaviour.

The code that gives the problem:

	if ( ARRAY_A == $args['output'] ) {
		$GLOBALS['_menu_item_sort_prop'] = $args['output_key'];
		usort($items, '_sort_nav_menu_items');
		$i = 1;
		foreach( $items as $k => $item ) {
			$items[$k]->$args['output_key'] = $i++;

Change History (1)

comment:1 @scribu4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.