Changeset 25244
- Timestamp:
- 09/04/2013 08:55:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/post.php (modified) (1 diff)
-
tests/phpunit/tests/post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r25234 r25244 3736 3736 } 3737 3737 3738 if ( $parent >= 0 ) 3738 if ( is_array( $parent ) ) { 3739 $post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) ); 3740 if ( ! empty( $post_parent__in ) ) 3741 $where .= " AND post_parent IN ($post_parent__in)"; 3742 } elseif ( $parent >= 0 ) { 3739 3743 $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); 3744 } 3740 3745 3741 3746 if ( 1 == count( $post_status ) ) { -
trunk/tests/phpunit/tests/post.php
r25168 r25244 824 824 $this->assertEquals( $inc, $exc_result ); 825 825 } 826 827 function test_get_pages_parent() { 828 $page_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) ); 829 $page_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) ); 830 $page_id3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) ); 831 $page_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) ); 832 833 $pages = get_pages( array( 'parent' => 0, 'hierarchical' => false ) ); 834 $this->assertEqualSets( array( $page_id1 ), wp_list_pluck( $pages, 'ID' ) ); 835 836 $pages = get_pages( array( 'parent' => $page_id1, 'hierarchical' => false ) ); 837 $this->assertEqualSets( array( $page_id2, $page_id4 ), wp_list_pluck( $pages, 'ID' ) ); 838 839 $pages = get_pages( array( 'parent' => array( $page_id1, $page_id2 ), 'hierarchical' => false ) ); 840 $this->assertEqualSets( array( $page_id2, $page_id3, $page_id4 ), wp_list_pluck( $pages, 'ID' ) ); 841 842 $pages = get_pages( array( 'parent' => 0 ) ); 843 $this->assertEqualSets( array( $page_id1 ), wp_list_pluck( $pages, 'ID' ) ); 844 845 $pages = get_pages( array( 'parent' => $page_id1 ) ); 846 $this->assertEqualSets( array( $page_id2, $page_id4 ), wp_list_pluck( $pages, 'ID' ) ); 847 848 $pages = get_pages( array( 'parent' => array( $page_id1, $page_id2 ) ) ); 849 $this->assertEqualSets( array( $page_id2, $page_id3, $page_id4 ), wp_list_pluck( $pages, 'ID' ) ); 850 } 826 851 }
Note: See TracChangeset
for help on using the changeset viewer.