get_ancestors
Filter HookDescription
Filters a given object's ancestors.Hook Information
File Location |
wp-includes/taxonomy.php
View on GitHub
|
Hook Type | Filter |
Line Number | 5006 |
Hook Parameters
Type | Name | Description |
---|---|---|
int[]
|
$ancestors
|
An array of IDs of object ancestors. |
int
|
$object_id
|
Object ID. |
string
|
$object_type
|
Type of object. |
string
|
$resource_type
|
Type of resource $object_type is. |
Usage Examples
Basic Usage
<?php
// Hook into get_ancestors
add_filter('get_ancestors', 'my_custom_filter', 10, 4);
function my_custom_filter($ancestors, $object_id, $object_type, $resource_type) {
// Your custom filtering logic here
return $ancestors;
}
Source Code Context
wp-includes/taxonomy.php:5006
- How this hook is used in WordPress core
<?php
5001 * @param int[] $ancestors An array of IDs of object ancestors.
5002 * @param int $object_id Object ID.
5003 * @param string $object_type Type of object.
5004 * @param string $resource_type Type of resource $object_type is.
5005 */
5006 return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
5007 }
5008
5009 /**
5010 * Returns the term's parent's term ID.
5011 *
PHP Documentation
<?php
/**
* Filters a given object's ancestors.
*
* @since 3.1.0
* @since 4.1.1 Introduced the `$resource_type` parameter.
*
* @param int[] $ancestors An array of IDs of object ancestors.
* @param int $object_id Object ID.
* @param string $object_type Type of object.
* @param string $resource_type Type of resource $object_type is.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/taxonomy.php
Related Hooks
Related hooks will be displayed here in future updates.