get_ancestors хук-фильтрWP 3.1.0

Filters a given object's ancestors.

Использование

add_filter( 'get_ancestors', 'wp_kama_get_ancestors_filter', 10, 4 );

/**
 * Function for `get_ancestors` filter-hook.
 * 
 * @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.
 *
 * @return int[]
 */
function wp_kama_get_ancestors_filter( $ancestors, $object_id, $object_type, $resource_type ){

	// filter...
	return $ancestors;
}
$ancestors(int[])
An array of IDs of object ancestors.
$object_id(int)
Object ID.
$object_type(строка)
Type of object.
$resource_type(строка)
Type of resource $object_type is.

Список изменений

С версии 3.1.0 Введена.
С версии 4.1.1 Introduced the $resource_type parameter.

Где вызывается хук

get_ancestors()
get_ancestors
wp-includes/taxonomy.php 4989
return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
wp-includes/taxonomy.php 4957
return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );

Где используется хук в WordPress

Использование не найдено.