首页 WordPress函数大全 get_object_taxonomies()

get_object_taxonomies()

2020-05-01 / 6147阅 / 悠然

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

get_object_taxonomies( string|string[]|WP_Post $object, string $output = 'names' )

Return the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name.

描述

Example:

$taxonomies = get_object_taxonomies( 'post' ); 

This results in:

Array( 'category', 'post_tag' ) 

参数

$object

(string|string[]|WP_Post)
(Required)
Name of the type of taxonomy object, or an object (row from posts)

$output

(string)
(Optional)
The type of output to return in the array. Accepts either 'names' or 'objects'.

Default value: 'names'

返回

(string[]|WP_Taxonomy[]) The names or objects of all taxonomies of $object_type.

大家谈论
    我的见解