Changeset 28622
- Timestamp:
- 05/29/2014 08:41:53 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r28613 r28622 2768 2768 $p_status = array(); 2769 2769 $e_status = array(); 2770 if ( in_array('any', $q_status) ) { 2771 foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status ) 2772 $e_status[] = "$wpdb->posts.post_status <> '$status'"; 2770 if ( in_array( 'any', $q_status ) ) { 2771 foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) { 2772 if ( ! in_array( $status, $q_status ) ) { 2773 $e_status[] = "$wpdb->posts.post_status <> '$status'"; 2774 } 2775 } 2773 2776 } else { 2774 2777 foreach ( get_post_stati() as $status ) { -
trunk/tests/phpunit/tests/post/query.php
r28621 r28622 742 742 $this->assertEqualSets( $ordered, wp_list_pluck( $attached->posts, 'ID' ) ); 743 743 } 744 745 function test_post_status() { 746 $statuses1 = get_post_stati(); 747 $this->assertContains( 'auto-draft', $statuses1 ); 748 749 $statuses2 = get_post_stati( array( 'exclude_from_search' => true ) ); 750 $this->assertContains( 'auto-draft', $statuses2 ); 751 752 $statuses3 = get_post_stati( array( 'exclude_from_search' => false ) ); 753 $this->assertNotContains( 'auto-draft', $statuses3 ); 754 755 $q1 = new WP_Query( array( 'post_status' => 'any' ) ); 756 $this->assertContains( "post_status <> 'auto-draft'", $q1->request ); 757 758 $q2 = new WP_Query( array( 'post_status' => 'any, auto-draft' ) ); 759 $this->assertNotContains( "post_status <> 'auto-draft'", $q2->request ); 760 761 $q3 = new WP_Query( array( 'post_status' => array( 'any', 'auto-draft' ) ) ); 762 $this->assertNotContains( "post_status <> 'auto-draft'", $q3->request ); 763 } 744 764 }
Note: See TracChangeset
for help on using the changeset viewer.