Allow get_post_ancestors() to inspect the $post global, when null/0 is received. see #23708.

git-svn-id: http://core.svn.wordpress.org/trunk@23635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-03-07 06:49:46 +00:00
parent 831afad92c
commit 3828d67fad
1 changed files with 1 additions and 4 deletions

View File

@ -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();