$resource_type = 'post_type';
} } if ( 'taxonomy' ===
$resource_type ) { $term =
get_term( $object_id,
$object_type );
while ( !
is_wp_error( $term ) && !
empty( $term->parent
) && !
in_array( $term->parent,
$ancestors, true
) ) { $ancestors[] =
(int) $term->parent;
$term =
get_term( $term->parent,
$object_type );
} } elseif ( 'post_type' ===
$resource_type ) { $ancestors =
get_post_ancestors( $object_id );
} /**
* Filters a given object's ancestors.
*
* @since 3.1.0
* @since 4.1.1 Introduced the `$resource_type` parameter.
*
* @param int[] $ancestors An array of IDs of object ancestors.
* @param int $object_id Object ID.
* @param string $object_type Type of object.
* @param string $resource_type Type of resource $object_type is.
*/