get_ancestors ( $object_id = 0, $object_type = '', $resource_type = '' )

  • (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.
  • (int[]) An array of IDs of ancestors from lowest to highest in the hierarchy.
Defined at:
Change Log:
  • 4: .


Gets an array of ancestor IDs for a given object.

Related Functions

get_post_ancestors, _get_post_ancestors, get_networks, get_network, wp_get_network

Top Google Results

User discussions

wpseek mobile