当前浏览:首页 / WordPress函数 / taxonomy_exists()

taxonomy_exists( string $taxonomy )

分类法名称是否存在

exists 判断存在

taxmore...

taxonomy 分类法more...


描述

以前为is_taxonomy(),在2.3.0中引入。

更多类似的主题函数信息,请查看主题开发手册中的条件标签文章。


参数

$taxonomy

(string) (必填) 分类法对象的名称


返回

(bool) 分类法是否存在。



源码

查看源码 官方文档


更新日志

版本描述
3.0.0开始引入

使用示例

  • 示例1

    基本示例

    $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