描述
以前为is_taxonomy(),在2.3.0中引入。
更多类似的主题函数信息,请查看主题开发手册中的条件标签文章。
参数
- $taxonomy
-
(string) (必填) 分类法对象的名称
返回
(bool) 分类法是否存在。
源码
更新日志
版本 | 描述 |
---|---|
3.0.0 | 开始引入 |
使用示例
基本示例
$taxonomy_exist = taxonomy_exists( 'category' ); // Returns true $taxonomy_exist = taxonomy_exists( 'post_tag' ); // Returns true $taxonomy_exist = taxonomy_exists( 'link_category' ); // Returns true $taxonomy_exist = taxonomy_exists( 'my_taxonomy' ); // Returns false if global $wp_taxonomies['my_taxonomy'] is not set