Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_ancestors

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
4594  */
4595 function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) {
4596      $object_id = (int) $object_id;
4597
4598      $ancestors = array();
4599
4600      if ( empty( $object_id ) ) {
4601
4602           /** This filter is documented in wp-includes/taxonomy.php */
4603           return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
4604      }
4605
4606      if ( ! $resource_type ) {
4607           if ( is_taxonomy_hierarchical( $object_type ) ) {
4608                $resource_type = 'taxonomy';
4609           } elseif ( post_type_exists( $object_type ) ) {
4610                $resource_type = 'post_type';
4611           }
4612      }
 
Line Code
4626       *
4627       * @since 3.1.0
4628       * @since 4.1.1 Introduced the `$resource_type` parameter.
4629       *
4630       * @param array  $ancestors     An array of object ancestors.
4631       * @param int    $object_id     Object ID.
4632       * @param string $object_type   Type of object.
4633       * @param string $resource_type Type of resource $object_type is.
4634       */
4635      return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
4636 }
4637
4638 /**
4639  * Returns the term's parent's term_ID.
4640  *
4641  * @since 3.1.0
4642  *
4643  * @param int    $term_id  Term ID.
4644  * @param string $taxonomy Taxonomy name.