WordPress.org

Make WordPress Core

Changeset 21953


Ignore:
Timestamp:
09/22/2012 04:21:06 PM (8 years ago)
Author:
nacin
Message:

Properly indent after [21952]. see #11399.

File:
1 edited

Legend:

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

    r21952 r21953  
    558558    $post = get_post( $post );
    559559
    560         $ancestors = array();
    561 
    562         if ( !empty( $post->post_parent ) && $post->ID != $post->post_parent ) {
    563             $id = $ancestors[] = $post->post_parent;
    564 
    565             while ( $ancestor = get_post( $id ) ) {
    566                 // Loop detection: If the ancestor has been seen before, break.
    567                 if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
    568                     break;
    569 
    570                 $id = $ancestors[] = $ancestor->post_parent;
    571             }
    572         }
     560    if ( empty( $post->post_parent ) || $post->post_parent == $post->ID )
     561        return array();
     562
     563    $ancestors = array();
     564
     565    $id = $ancestors[] = $post->post_parent;
     566
     567    while ( $ancestor = get_post( $id ) ) {
     568        // Loop detection: If the ancestor has been seen before, break.
     569        if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
     570            break;
     571
     572        $id = $ancestors[] = $ancestor->post_parent;
     573    }
    573574
    574575    return $ancestors;
Note: See TracChangeset for help on using the changeset viewer.