wp_delete_category

Deletes one existing category.

Description

(bool|int|WP_Error) wp_delete_category( (int) $cat_ID ); 

Returns (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.

Parameters (1)

0. $cat_id (int)
The cat id.

Usage

  1. if ( !function_exists( 'wp_delete_category' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // The cat id. 
  5. $cat_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_delete_category($cat_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/taxonomy.php  
  1. function wp_delete_category( $cat_ID ) { 
  2. return wp_delete_term( $cat_ID, 'category' );