Uses
Uses | Description |
---|---|
wp-includes/taxonomy.php: term_exists() | Determines whether a taxonomy term exists. |
Check whether a category exists.
(int|string) (Required) Category name.
(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 | Description |
---|---|
2.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/category_exists