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:
parent
831afad92c
commit
3828d67fad
|
@ -681,12 +681,9 @@ final class WP_Post {
|
||||||
* @return array Ancestor IDs or empty array if none are found.
|
* @return array Ancestor IDs or empty array if none are found.
|
||||||
*/
|
*/
|
||||||
function get_post_ancestors( $post ) {
|
function get_post_ancestors( $post ) {
|
||||||
if ( ! $post )
|
|
||||||
return array();
|
|
||||||
|
|
||||||
$post = get_post( $post );
|
$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();
|
return array();
|
||||||
|
|
||||||
$ancestors = array();
|
$ancestors = array();
|
||||||
|
|
Loading…
Reference in New Issue