Give up on making uninterrupted hierarchies work in `get_page_children()` for now, reverts [30159], [30246], [30636].
Props boonebgorges. See #14477. Built from https://develop.svn.wordpress.org/trunk@30735 git-svn-id: http://core.svn.wordpress.org/trunk@30725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1bb20da03b
commit
48620242c4
|
@ -4284,25 +4284,15 @@ function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' )
|
|||
function get_page_children( $page_id, $pages ) {
|
||||
$page_list = array();
|
||||
foreach ( (array) $pages as $page ) {
|
||||
if ( $page->post_parent == $page_id || in_array( $page_id, $page->ancestors ) ) {
|
||||
if ( $page->post_parent == $page_id ) {
|
||||
$page_list[] = $page;
|
||||
if ( $children = get_page_children( $page->ID, $pages, false ) ) {
|
||||
if ( $children = get_page_children( $page->ID, $pages ) ) {
|
||||
$page_list = array_merge( $page_list, $children );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure uniqueness.
|
||||
$page_ids = array();
|
||||
$unique_page_list = array();
|
||||
foreach ( $page_list as $page_list_item ) {
|
||||
if ( ! in_array( $page_list_item->ID, $page_ids ) ) {
|
||||
$unique_page_list[] = $page_list_item;
|
||||
$page_ids[] = $page_list_item->ID;
|
||||
}
|
||||
}
|
||||
|
||||
return $unique_page_list;
|
||||
return $page_list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4633,9 +4623,6 @@ function get_pages( $args = array() ) {
|
|||
// Update cache.
|
||||
update_post_cache( $pages );
|
||||
|
||||
// Convert to WP_Post instances
|
||||
$pages = array_map( 'get_post', $pages );
|
||||
|
||||
if ( $child_of || $hierarchical ) {
|
||||
$pages = get_page_children($child_of, $pages);
|
||||
}
|
||||
|
@ -4664,6 +4651,9 @@ function get_pages( $args = array() ) {
|
|||
|
||||
wp_cache_set( $cache_key, $page_structure, 'posts' );
|
||||
|
||||
// Convert to WP_Post instances
|
||||
$pages = array_map( 'get_post', $pages );
|
||||
|
||||
/**
|
||||
* Filter the retrieved list of pages.
|
||||
*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.1-beta2-30734';
|
||||
$wp_version = '4.1-beta2-30735';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue