函数原型
get_object_taxonomies( string|string[]|WP_Post $object, string $output = ‘names’ ): string[]|WP_Taxonomy[]
函数描述
Returns 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.
是否弃用
未弃用
函数参数
-
$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'names'.Default:
'names'
函数返回值
string[]|WP_Taxonomy[] The names or objects of all taxonomies of $object_type.
函数位置
File: wp-includes/taxonomy.php.
函数源码
$taxonomies = get_object_taxonomies( 'post' );源码链接
变更日志
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |

