From 5edb7a633f5135d926b4b17682dab23173ef1751 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 22 May 2014 18:50:11 +0000 Subject: [PATCH] Remove unnecessary array_reverse() from wp_get_post_revisions(). WP_Query properly handles multiple 'orderby' values since [28541]. fixes #26042. git-svn-id: https://develop.svn.wordpress.org/trunk@28543 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/revision.php | 4 +--- tests/phpunit/tests/post/revisions.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php index 52412cdb51..ee02ce97fe 100644 --- a/src/wp-includes/revision.php +++ b/src/wp-includes/revision.php @@ -417,7 +417,7 @@ function wp_get_post_revisions( $post_id = 0, $args = null ) { if ( ! $post || empty( $post->ID ) ) return array(); - $defaults = array( 'order' => 'ASC', 'orderby' => 'date ID', 'check_enabled' => true ); + $defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true ); $args = wp_parse_args( $args, $defaults ); if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) @@ -428,8 +428,6 @@ function wp_get_post_revisions( $post_id = 0, $args = null ) { if ( ! $revisions = get_children( $args ) ) return array(); - $revisions = array_reverse( $revisions ); - return $revisions; } diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php index ce53784b0d..4011b659ad 100644 --- a/tests/phpunit/tests/post/revisions.php +++ b/tests/phpunit/tests/post/revisions.php @@ -353,7 +353,7 @@ class Tests_Post_Revisions extends WP_UnitTestCase { function _filter_query( $sql ) { remove_filter( 'query', array( $this, '_filter_query' ) ); global $wpdb; - $this->assertContains( "ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID ASC", $sql ); + $this->assertContains( "ORDER BY $wpdb->posts.post_date DESC, $wpdb->posts.ID DESC", $sql ); return $sql; }