Changeset 31321
- Timestamp:
- 02/01/2015 08:25:42 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r31312 r31321 2964 2964 $user_id = get_current_user_id(); 2965 2965 2966 $q_status = array(); 2966 2967 if ( ! empty( $q['post_status'] ) ) { 2967 2968 $statuswheres = array(); … … 3528 3529 $post_status_obj = get_post_status_object($status); 3529 3530 //$type = get_post_type($this->posts[0]); 3530 if ( !$post_status_obj->public ) { 3531 3532 // If the post_status was specifically requested, let it pass through. 3533 if ( !$post_status_obj->public && ! in_array( $status, $q_status ) ) { 3534 3531 3535 if ( ! is_user_logged_in() ) { 3532 3536 // User must be logged in to view unpublished posts. -
trunk/tests/phpunit/tests/query/postStatus.php
r31114 r31321 299 299 $this->assertEmpty( $q->posts ); 300 300 } 301 302 /** 303 * @ticket 29167 304 */ 305 public function test_specific_post_should_be_returned_if_trash_is_one_of_the_requested_post_statuses() { 306 $p1 = $this->factory->post->create( array( 'post_status' => 'trash' ) ); 307 $p2 = $this->factory->post->create( array( 'post_status' => 'publish' ) ); 308 309 $q = new WP_Query( array( 310 'p' => $p1, 311 'post_status' => array( 'trash', 'publish' ), 312 ) ); 313 314 $this->assertContains( $p1, wp_list_pluck( $q->posts, 'ID' ) ); 315 } 301 316 }
Note: See TracChangeset
for help on using the changeset viewer.