wp-admin/includes/taxonomy.php:55Adds a new category to the database if it does not already exist.
$cat_nameint|string$category_parentintoptional0int|WP_Errorfunction wp_create_category( $cat_name, $category_parent = 0 ) { $id = category_exists( $cat_name, $category_parent ); if ( $id ) { return $id; } return wp_insert_category( array( 'cat_name' => $cat_name, 'category_parent' => $category_parent, ) );}Introduced in 2.0.0. 3 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$category_name added.verified against source$cat_name removed.verified against sourceint|WP_Error to int.verified against sourcesrc/wp-admin/includes/taxonomy.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.