WordPress.org

Make WordPress Core

Changeset 28543


Ignore:
Timestamp:
05/22/2014 06:50:11 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Remove unnecessary array_reverse() from wp_get_post_revisions().

WP_Query properly handles multiple 'orderby' values since [28541].

fixes #26042.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/revision.php

    r28541 r28543  
    418418        return array();
    419419
    420     $defaults = array( 'order' => 'ASC', 'orderby' => 'date ID', 'check_enabled' => true );
     420    $defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
    421421    $args = wp_parse_args( $args, $defaults );
    422422
     
    428428    if ( ! $revisions = get_children( $args ) )
    429429        return array();
    430 
    431     $revisions = array_reverse( $revisions );
    432430
    433431    return $revisions;
  • trunk/tests/phpunit/tests/post/revisions.php

    r28541 r28543  
    354354        remove_filter( 'query', array( $this, '_filter_query' ) );
    355355        global $wpdb;
    356         $this->assertContains( "ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID ASC", $sql );
     356        $this->assertContains( "ORDER BY $wpdb->posts.post_date DESC, $wpdb->posts.ID DESC", $sql );
    357357        return $sql;
    358358    }
Note: See TracChangeset for help on using the changeset viewer.