category_exists( int|string $cat_name, int $parent = null )
Check whether a category exists.
描述
参数
- $cat_name
-
(int|string)
(Required)
Category name. - $parent
-
(int)
(Optional)
ID of parent term.Default value: null
返回值
(mixed)
源代码
File: wp-admin/includes/taxonomy.php
function category_exists( $cat_name, $parent = null ) {
$id = term_exists($cat_name, 'category', $parent);
if ( is_array($id) )
$id = $id['term_id'];
return $id;
}
更新日志
Version | 描述 |
---|---|
2.0.0 | Introduced. |
相关函数
Uses
-
wp-includes/taxonomy.php:
term_exists()
Used By
-
wp-admin/includes/taxonomy.php:
wp_create_category() -
wp-admin/includes/taxonomy.php:
wp_create_categories()
User Contributed Notes
你可能对这些文章感兴趣:
- wordpress函数esc_html_x()用法示例
- wordpress函数esc_html()用法示例
- wordpress函数esc_html_e()用法示例
- wordpress函数esc_attr_x()用法示例
- wordpress函数esc_attr__()用法示例
- wordpress函数esc_attr()用法示例
- wordpress函数esc_attr_e()用法示例
- wordpress函数enqueue_embed_scripts()用法示例
- wordpress函数ent2ncr()用法示例
- wordpress函数enqueue_comment_hotkeys_js()用法示例
- wordpress函数edit_user()用法示例
- wordpress函数email_exists()用法示例
- wordpress函数endElement()用法示例
- wordpress函数edit_term_link()用法示例
如有疑问,请前往问答中心反馈!
反馈