WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp delete category

Contents

Description

Deletes one existing category.

Usage

<?php wp_delete_category$cat_ID ?>

Parameters

$cat_ID
(integer) (required)
Default: None

Return Values

(mixed) 
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.

Examples

<?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";
}
?>

Notes

Change Log

Since: 2.0.0

Source File

wp_delete_category() is located in wp-includes/taxonomy.php.

Related

See also index of Function Reference and index of Template Tags.