From 3f051e73ef6f424730d35b62316b094ac39896d6 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 22 Sep 2012 16:21:06 +0000 Subject: [PATCH] Properly indent after [21952]. see #11399. git-svn-id: https://develop.svn.wordpress.org/trunk@21953 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 613c2f4f6c..b2ac1089a2 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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; }