get_ancestors
get_ancestors ( $object_id = 0, $object_type = '', $resource_type = '' )
Parameters:- (int) object_id Optional. The ID of the object. Default 0.
- (string) object_type Optional. The type of object for which we'll be retrieving ancestors. Accepts a post type or a taxonomy name. Default empty.
- (string) resource_type Optional. Type of resource $object_type is. Accepts 'post_type' or 'taxonomy'. Default empty.
Returns:- (int[]) An array of IDs of ancestors from lowest to highest in the hierarchy.
Defined at:Change Log: - Introduced in WordPress: 3.1.0
- Deprecated in WordPress: —
Description
Gets an array of ancestor IDs for a given object.