Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
post_type_exists() - 文章类型是否有注册 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / post_type_exists()

post_type_exists( string $post_type )

文章类型是否有注册


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "2df702d60daa556bbc409461c8106fdb" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "b2f7dfdca5567db6f986bb6af13827bd" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

exists 判断存在

post_type 文章类型more...


描述

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

另见


参数

$post_type

(string) (必填) 文章类型名称


返回

(bool) 是否注册了文章类型。



源码

查看源码 官方文档


更新日志

版本描述
3.0.0开始引入

使用示例

  • 示例1

    基本示例

    $exists = post_type_exists( 'post' );
    // returns true
     
    $exists = post_type_exists( 'page' );
    // returns true
     
    $exists = post_type_exists( 'book' );
    // returns true if book is a registered post type
     
    $exists = post_type_exists( 'xyz' );
    // returns false if xyz is not a registered post type