wp_delete_category( int $cat_ID )
Deletes one existing category.
Description Description
Parameters Parameters
- $cat_ID
-
(int) (Required) Category term ID.
Return Return
(bool|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.
Source Source
File: wp-includes/taxonomy.php
function wp_delete_category( $cat_ID ) {
return wp_delete_term( $cat_ID, 'category' );
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
<?php $categ_ID = 3; if ( wp_delete_category( $categ_ID ) ) { echo "Category #$categ_ID was successfully deleted"; } else { echo "Impossible to delete category #$categ_ID! Make sure it exists and that it's not the default category"; } ?>