diff --git src/wp-includes/post.php src/wp-includes/post.php
index 3b3d55f..b9976a5 100644
|
|
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) |
4280 | 4280 | * |
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 ) ) { |
4292 | 4291 | $page_list = array_merge( $page_list, $children ); |
4293 | 4292 | } |
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 | |
4299 | 4309 | /** |