category_exists()
category_exists( int|string $cat_name, int $parent = null )
检查类别是否存在。
Check whether a category exists.
说明(Description)
另见函数 term_exists()
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$cat_name | (int | string) | 必需 | 类别名称。 |
$parent | (int) | 可选 | 父项的ID。 |
返回(Return)
(mixed)
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.0.0 | wp-admin/includes/taxonomy.php:24 | 2 | 1 function |
笔记(Notes)
请注意,此功能仅在wp admin中可用,如果在站点前端使用,则会引发错误。使用术语存在。
category_exists() 为WP2原创文章,链接:https://www.wp2.cn/functions/category_exists/