Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_post_ancestors [ WordPress Function ]

get_post_ancestors ( $post )
Parameters:
  • (int|object) $post Post ID or post object
Returns:
  • (array) Ancestor IDs or empty array if none are found.
Defined at:



Retrieve ancestors of a post.

Source


<?php
function get_post_ancestors($post) {
    
$post get_post($post);

    if ( ! isset( 
$post->ancestors ) )
        
_get_post_ancestors$post );

    if ( ! empty( 
$post->ancestors ) )
        return 
$post->ancestors;

    return array();
}
?>

Examples [ wp-snippets.com ]

Top Google Search Results

More ...

0 User Note(s)

None yet. Be the first!

Add New ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics