wppaste
WordPress

apply_filters( 'get_ancestors', int[] $ancestors, int $object_id, string $object_type, string $resource_type )

Since
3.1.0, 4.1.1
Filters a given object's ancestors.

Compatibility

WordPress
since 4.1.1
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$ancestorsint[]
An array of IDs of object ancestors.
$object_idint
Object ID.
$object_typestring
Type of object.
$resource_typestring
Type of resource $object_type is.

Where this hook fires · 2

  • wp-includes/taxonomy.php:4974get_ancestors()
  • wp-includes/taxonomy.php:5006get_ancestors()

Source code

	 *	 * @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 apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );} /** * Returns the term's parent's term ID. * * @since 3.1.0

Changelog

Introduced in 4.1.1. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.1.1
Introduced the $resource_type parameter.from the docblock
3.1.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.