首页 WordPress函数大全 get_ancestors()

get_ancestors()

2020-05-01 / 3865阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_ancestors( int $object_id, string $object_type = '', string $resource_type = '' )

Get an array of ancestor IDs for a given object.

描述

参数

$object_id

(int)
(Optional)
The ID of the object. Default 0.

$object_type

(string)
(Optional)
The type of object for which we'll be retrieving ancestors. Accepts a post type or a taxonomy name.

Default value: ''

$resource_type

(string)
(Optional)
Type of resource $object_type is. Accepts 'post_type' or 'taxonomy'.

Default value: ''

返回

(int[]) An array of IDs of ancestors from lowest to highest in the hierarchy.

大家谈论
    我的见解