WordPress.org

Make WordPress Core

Ticket #26042: 26042.6.diff

File 26042.6.diff, 1.3 KB (added by SergeyBiryukov, 6 years ago)
  • src/wp-includes/revision.php

     
    417417        if ( ! $post || empty( $post->ID ) )
    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
    423423        if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
     
    428428        if ( ! $revisions = get_children( $args ) )
    429429                return array();
    430430
    431         $revisions = array_reverse( $revisions );
    432 
    433431        return $revisions;
    434432}
    435433
  • tests/phpunit/tests/post/revisions.php

     
    353353        function _filter_query( $sql ) {
    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        }
    359359