wp_delete_category()
Deletes one existing category.
No Hooks.
Returns
true|false|Int|WP_Error. Returns true if completes delete action; false if term doesn't exist; Zero on attempted deletion of default Category; WP_Error object is also a possibility.
Usage
wp_delete_category( $cat_id );
- $cat_id(int) (required)
- Category term ID.
Changelog
| Since 2.0.0 | Introduced. |
wp_delete_category() wp delete category code WP 7.0
function wp_delete_category( $cat_id ) {
return wp_delete_term( $cat_id, 'category' );
}