get_ancestors WordPress Filter Hook

The get_ancestors hook is used to return an array of ancestor IDs for a given post. This can be useful for displaying a breadcrumb trail of parent pages for a given post.

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

Filters a given object’s ancestors.


Parameters

$ancestors

(int[])An array of IDs of object ancestors.

$object_id

(int)Object ID.

$object_type

(string)Type of object.

$resource_type

(string)Type of resource $object_type is.


Top ↑

Source

File: wp-includes/taxonomy.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.1.1Introduced the $resource_type parameter.
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More