Changeset 30636 for trunk/src/wp-includes/post.php
- Timestamp:
- 11/30/2014 06:04:31 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r30629 r30636 4281 4281 * @param int $page_id Page ID. 4282 4282 * @param array $pages List of pages' objects. 4283 * @param bool $ancestors Whether to check a page's ancestors.4284 4283 * @return array List of page children. 4285 4284 */ 4286 function get_page_children( $page_id, $pages , $ancestors = true) {4285 function get_page_children( $page_id, $pages ) { 4287 4286 $page_list = array(); 4288 4287 foreach ( (array) $pages as $page ) { 4289 if ( $page->post_parent == $page_id || ( $ancestors && in_array( $page_id, $page->ancestors )) ) {4288 if ( $page->post_parent == $page_id || in_array( $page_id, $page->ancestors ) ) { 4290 4289 $page_list[] = $page; 4291 4290 if ( $children = get_page_children( $page->ID, $pages, false ) ) { … … 4294 4293 } 4295 4294 } 4296 return $page_list; 4295 4296 // Ensure uniqueness. 4297 $page_ids = array(); 4298 $unique_page_list = array(); 4299 foreach ( $page_list as $page_list_item ) { 4300 if ( ! in_array( $page_list_item->ID, $page_ids ) ) { 4301 $unique_page_list[] = $page_list_item; 4302 $page_ids[] = $page_list_item->ID; 4303 } 4304 } 4305 4306 return $unique_page_list; 4297 4307 } 4298 4308
Note: See TracChangeset
for help on using the changeset viewer.