Skip to content

Commit

Permalink
Properly indent after [21952]. see #11399.
Browse files Browse the repository at this point in the history
git-svn-id: http://core.svn.wordpress.org/trunk@21953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Sep 22, 2012
1 parent a42ce23 commit 29b7d26
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,19 +557,20 @@ function get_post_ancestors( $post ) {

$post = get_post( $post );

$ancestors = array();
if ( empty( $post->post_parent ) || $post->post_parent == $post->ID )
return array();

if ( !empty( $post->post_parent ) && $post->ID != $post->post_parent ) {
$id = $ancestors[] = $post->post_parent;
$ancestors = array();

while ( $ancestor = get_post( $id ) ) {
// Loop detection: If the ancestor has been seen before, break.
if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
break;
$id = $ancestors[] = $post->post_parent;

$id = $ancestors[] = $ancestor->post_parent;
}
}
while ( $ancestor = get_post( $id ) ) {
// Loop detection: If the ancestor has been seen before, break.
if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
break;

$id = $ancestors[] = $ancestor->post_parent;
}

return $ancestors;
}
Expand Down

0 comments on commit 29b7d26

Please sign in to comment.