mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-27 10:08:27 +00:00
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:
parent
335f26a40d
commit
0804e392a2
@ -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…
x
Reference in New Issue
Block a user