Changeset 30159
- Timestamp:
- 11/01/2014 08:43:55 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r30158 r30159 4286 4286 $page_list = array(); 4287 4287 foreach ( (array) $pages as $page ) { 4288 if ( $page->post_parent == $page_id ) {4288 if ( $page->post_parent == $page_id || in_array( $page_id, $page->ancestors ) ) { 4289 4289 $page_list[] = $page; 4290 4290 if ( $children = get_page_children($page->ID, $pages) ) … … 4620 4620 update_post_cache( $pages ); 4621 4621 4622 // Convert to WP_Post instances 4623 $pages = array_map( 'get_post', $pages ); 4624 4622 4625 if ( $child_of || $hierarchical ) { 4623 4626 $pages = get_page_children($child_of, $pages); … … 4647 4650 4648 4651 wp_cache_set( $cache_key, $page_structure, 'posts' ); 4649 4650 // Convert to WP_Post instances.4651 $pages = array_map( 'get_post', $pages );4652 4652 4653 4653 /** -
trunk/tests/phpunit/tests/post/getPages.php
r28399 r30159 269 269 $this->assertCount( 2, $exclude6 ); 270 270 } 271 272 /** 273 * @ticket 14477 274 */ 275 function test_get_pages_interrupted_hierarchy() { 276 $page1 = $this->factory->post->create( array( 'post_type' => 'page' ) ); 277 $page2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page1 ) ); 278 add_post_meta( $page2, 'color', 'red' ); 279 $page3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page2 ) ); 280 add_post_meta( $page3, 'color', 'blue' ); 281 282 $pages = get_pages( array( 'child_of' => $page1, 'meta_key' => 'color', 'meta_value' => 'blue' ) ); 283 $this->assertEqualSets( array( $page3 ), wp_list_pluck( $pages, 'ID' ) ); 284 } 271 285 }
Note: See TracChangeset
for help on using the changeset viewer.