Make WordPress Core


Ignore:
Timestamp:
12/04/2014 12:23:47 AM (11 years ago)
Author:
wonderboymusic
Message:

Give up on making uninterrupted hierarchies work in get_page_children() for now, reverts [30159], [30246], [30636].

Props boonebgorges.
See #14477.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r30725 r30735  
    42854285    $page_list = array();
    42864286    foreach ( (array) $pages as $page ) {
    4287         if ( $page->post_parent == $page_id || in_array( $page_id, $page->ancestors ) ) {
     4287        if ( $page->post_parent == $page_id ) {
    42884288            $page_list[] = $page;
    4289             if ( $children = get_page_children( $page->ID, $pages, false ) ) {
     4289            if ( $children = get_page_children( $page->ID, $pages ) ) {
    42904290                $page_list = array_merge( $page_list, $children );
    42914291            }
     
    42934293    }
    42944294
    4295     // Ensure uniqueness.
    4296     $page_ids = array();
    4297     $unique_page_list = array();
    4298     foreach ( $page_list as $page_list_item ) {
    4299         if ( ! in_array( $page_list_item->ID, $page_ids ) ) {
    4300             $unique_page_list[] = $page_list_item;
    4301             $page_ids[] = $page_list_item->ID;
    4302         }
    4303     }
    4304 
    4305     return $unique_page_list;
     4295    return $page_list;
    43064296}
    43074297
     
    46344624    update_post_cache( $pages );
    46354625
    4636     // Convert to WP_Post instances
    4637     $pages = array_map( 'get_post', $pages );
    4638 
    46394626    if ( $child_of || $hierarchical ) {
    46404627        $pages = get_page_children($child_of, $pages);
     
    46644651
    46654652    wp_cache_set( $cache_key, $page_structure, 'posts' );
     4653
     4654    // Convert to WP_Post instances
     4655    $pages = array_map( 'get_post', $pages );
    46664656
    46674657    /**
Note: See TracChangeset for help on using the changeset viewer.