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

Merges [23635] to the 3.5 branch.
fixes #23708.



git-svn-id: http://core.svn.wordpress.org/branches/3.5@23903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-04-04 15:57:46 +00:00
parent 335f26a40d
commit 0804e392a2

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