Make WordPress Core

Opened 9 years ago

Last modified 5 years ago

#32443 new defect (bug)

Upload iframe renders pictures in reverse order

Reported by: sapegin's profile sapegin Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2.2
Component: Media Keywords:
Focuses: administration Cc:


Attachments are in reverse order when they have menu_order attributes.

It is because this code in get_media_items function:

$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );

Generates this query:

…wp_posts.menu_order DESC, wp_posts.ID DESC…

It should be:

$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => array( 'menu_order' => 'ASC', 'ID' => 'DESC') ) );

Which will generate:

…wp_posts.menu_order ASC, wp_posts.ID DESC…

Change History (2)

#1 @SergeyBiryukov
9 years ago

  • Component changed from Administration to Media
Note: See TracTickets for help on using tickets.