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 |
---|---|
4871 | */ |
4872 | function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) { |
4873 | $object_id = (int) $object_id; |
4874 |
|
4875 | $ancestors = array(); |
4876 |
|
4877 | if ( empty( $object_id ) ) { |
4878 |
|
4879 | /** This filter is documented in wp-includes/taxonomy.php */ |
4880 | return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); |
4881 | } |
4882 |
|
4883 | if ( ! $resource_type ) { |
4884 | if ( is_taxonomy_hierarchical( $object_type ) ) { |
4885 | $resource_type = 'taxonomy'; |
4886 | } elseif ( post_type_exists( $object_type ) ) { |
4887 | $resource_type = 'post_type'; |
4888 | } |
4889 | } |
Line | Code |
4903 | * |
4904 | * @since 3.1.0 |
4905 | * @since 4.1.1 Introduced the `$resource_type` parameter. |
4906 | * |
4907 | * @param int[] $ancestors An array of IDs of object ancestors. |
4908 | * @param int $object_id Object ID. |
4909 | * @param string $object_type Type of object. |
4910 | * @param string $resource_type Type of resource $object_type is. |
4911 | */ |
4912 | return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type ); |
4913 | } |
4914 |
|
4915 | /** |
4916 | * Returns the term's parent's term ID. |
4917 | * |
4918 | * @since 3.1.0 |
4919 | * |
4920 | * @param int $term_id Term ID. |
4921 | * @param string $taxonomy Taxonomy name. |