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 |
---|---|
4496 | */ |
4497 | function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) { |
4498 | $object_id = (int) $object_id; |
4499 |
|
4500 | $ancestors = array(); |
4501 |
|
4502 | if ( empty( $object_id ) ) { |
4503 |
|
4504 | /** This filter is documented in wp-includes/taxonomy.php */ |
4505 | return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); |
4506 | } |
4507 |
|
4508 | if ( ! $resource_type ) { |
4509 | if ( is_taxonomy_hierarchical( $object_type ) ) { |
4510 | $resource_type = 'taxonomy'; |
4511 | } elseif ( post_type_exists( $object_type ) ) { |
4512 | $resource_type = 'post_type'; |
4513 | } |
4514 | } |
Line | Code |
4528 | * |
4529 | * @since 3.1.0 |
4530 | * @since 4.1.1 Introduced the `$resource_type` parameter. |
4531 | * |
4532 | * @param array $ancestors An array of object ancestors. |
4533 | * @param int $object_id Object ID. |
4534 | * @param string $object_type Type of object. |
4535 | * @param string $resource_type Type of resource $object_type is. |
4536 | */ |
4537 | return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); |
4538 | } |
4539 |
|
4540 | /** |
4541 | * Returns the term's parent's term_ID. |
4542 | * |
4543 | * @since 3.1.0 |
4544 | * |
4545 | * @param int $term_id Term ID. |
4546 | * @param string $taxonomy Taxonomy name. |