Ticket #37489: 37489-1.patch
File 37489-1.patch, 1.5 KB (added by , 8 years ago) |
---|
-
src/wp-includes/query.php
3018 3018 } 3019 3019 } 3020 3020 3021 if ( ! empty( $orderby ) and $orderby == "$wpdb->posts.post_date " . $q['order'] ) { 3022 $orderby = "$wpdb->posts.post_date " . $q['order']. ", $wpdb->posts.ID " . $q['order']; 3023 } 3024 3021 3025 // Order search results by relevance only when another "orderby" is not specified in the query. 3022 3026 if ( ! empty( $q['s'] ) ) { 3023 3027 $search_orderby = ''; -
tests/phpunit/tests/query/results.php
718 718 $feed_comment = $this->q->next_comment(); 719 719 $this->assertEquals( $comment_id, $feed_comment->comment_ID ); 720 720 } 721 722 723 public function test_posts_order_for_same_date() { 724 $this->factory->post->create_many( 100, array( 725 'post_date' => '2016-01-01 00:00:00' 726 ) ); 727 728 $expected = array_map( array( $this, 'get_post_id' ), $this->q->query( array() ) ); 729 $actual = array_map( array( $this, 'get_post_id' ), $this->q->query( array( 730 'post_status' => array( 731 'private', 732 'publish' 733 ) 734 ) ) ); 735 $this->assertSame( $expected, $actual ); 736 } 737 738 /** 739 * @param WP_Post $post 740 * @return int 741 */ 742 public function get_post_id( $post ) { 743 return $post->ID; 744 } 721 745 }