[wp-trac] [WordPress Trac] #15533: wp_get_nav_menu_items order doesn't work

WordPress Trac wp-trac at lists.automattic.com
Sun Nov 21 22:36:55 UTC 2010


#15533: wp_get_nav_menu_items order doesn't work
--------------------------+-------------------------------------------------
 Reporter:  markoheijnen  |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  3.1            
 Severity:  minor         |    Keywords:                 
--------------------------+-------------------------------------------------
Description changed by scribu:

Old description:

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

New description:

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

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15533#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list