WPDev.one
Core Function
View Source on Trac ↗

get_post_ancestors()

get_post_ancestors( mixed $post )

Retrieves the IDs of the ancestors of a post.

Parameters 1 required

Name / Type Description
(int

| WP_Post) $post Post ID or post object.

Required

Return Value

(int[])
Array of ancestor IDs or empty array if there are none.

Function Information

Since Version
2.5.0
Source File
wp-includes/post.php
Advertisement