WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
4628 | */ |
4629 | function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) { |
4630 | $object_id = (int) $object_id; |
4631 |
|
4632 | $ancestors = array(); |
4633 |
|
4634 | if ( empty( $object_id ) ) { |
4635 |
|
4636 | /** This filter is documented in wp-includes/taxonomy.php */ |
4637 | return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); |
4638 | } |
4639 |
|
4640 | if ( ! $resource_type ) { |
4641 | if ( is_taxonomy_hierarchical( $object_type ) ) { |
4642 | $resource_type = 'taxonomy'; |
4643 | } elseif ( post_type_exists( $object_type ) ) { |
4644 | $resource_type = 'post_type'; |
4645 | } |
4646 | } |
Line | Code |
4660 | * |
4661 | * @since 3.1.0 |
4662 | * @since 4.1.0 Introduced the `$resource_type` parameter. |
4663 | * |
4664 | * @param array $ancestors An array of object ancestors. |
4665 | * @param int $object_id Object ID. |
4666 | * @param string $object_type Type of object. |
4667 | * @param string $resource_type Type of resource $object_type is. |
4668 | */ |
4669 | return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); |
4670 | } |
4671 |
|
4672 | /** |
4673 | * Returns the term's parent's term_ID |
4674 | * |
4675 | * @since 3.1.0 |
4676 | * |
4677 | * @param int $term_id |
4678 | * @param string $taxonomy |