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
This commit is contained in:
parent
7e7cf2bb94
commit
f5de3b88a8
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user