From f5de3b88a826fc91fe820241c3d396c072fa2b24 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 7 Mar 2013 06:49:46 +0000 Subject: [PATCH] Allow get_post_ancestors() to inspect the $post global, when null/0 is received. see #23708. git-svn-id: https://develop.svn.wordpress.org/trunk@23635 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index a2352d4656..494e58673e 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -681,12 +681,9 @@ final class WP_Post { * @return array Ancestor IDs or empty array if none are found. */ function get_post_ancestors( $post ) { - if ( ! $post ) - return array(); - $post = get_post( $post ); - if ( empty( $post->post_parent ) || $post->post_parent == $post->ID ) + if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) return array(); $ancestors = array();