wp_insert_category
wp_insert_category ( $catarr, $wp_error = false )
Parameters:- (array) catarr { Array of arguments for inserting a new category. @type int $cat_ID Category ID. A non-zero value updates an existing category. Default 0. @type string $taxonomy Taxonomy slug. Default 'category'. @type string $cat_name Category name. Default empty. @type string $category_description Category description. Default empty. @type string $category_nicename Category nice (display) name. Default empty. @type int|string $category_parent Category parent ID. Default empty. }
- (bool) wp_error Optional. Default false.
Returns:- (int|WP_Error) The ID number of the new or updated Category on success. Zero or a WP_Error on failure, depending on param `$wp_error`.
Defined at:Change Log: - Introduced in WordPress: 2.0.0
- Deprecated in WordPress: —
Description
Updates an existing Category or creates a new Category.