wp_delete_category() WordPress Function

The wp_delete_category() function allows you to delete a category from your WordPress site. This function takes two arguments: the category ID and a boolean value for whether to delete the category's children categories.

wp_delete_category( int $cat_ID ) #

Deletes one existing category.


Parameters

$cat_ID

(int)(Required)Category term ID.


Top ↑

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.


Top ↑

Source

File: wp-includes/taxonomy.php

function wp_delete_category( $cat_ID ) {
	return wp_delete_term( $cat_ID, 'category' );
}


Top ↑

Changelog

Changelog
VersionDescription
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More