Changeset 30246
- Timestamp:
- 11/05/2014 08:04:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r30159 r30246 4279 4279 * @since 1.5.1 4280 4280 * 4281 * @param int $page_id Page ID. 4282 * @param array $pages List of pages' objects. 4281 * @param int $page_id Page ID. 4282 * @param array $pages List of pages' objects. 4283 * @param bool $ancestors Whether to check a page's ancestors. 4283 4284 * @return array List of page children. 4284 4285 */ 4285 function get_page_children( $page_id, $pages) {4286 function get_page_children( $page_id, $pages, $ancestors = true ) { 4286 4287 $page_list = array(); 4287 4288 foreach ( (array) $pages as $page ) { 4288 if ( $page->post_parent == $page_id || in_array( $page_id, $page->ancestors) ) {4289 if ( $page->post_parent == $page_id || ( $ancestors && in_array( $page_id, $page->ancestors ) ) ) { 4289 4290 $page_list[] = $page; 4290 if ( $children = get_page_children($page->ID, $pages) ) 4291 $page_list = array_merge($page_list, $children); 4291 if ( $children = get_page_children( $page->ID, $pages, false ) ) { 4292 $page_list = array_merge( $page_list, $children ); 4293 } 4292 4294 } 4293 4295 }
Note: See TracChangeset
for help on using the changeset viewer.