WPDev.one
Core Function
View Source on Trac ↗

wp_create_category()

wp_create_category( mixed $cat_name, mixed $category_parent = 0 )

Adds a new category to the database if it does not already exist.

Parameters 1 required

Name / Type Description
(int

| string) $cat_name Category name.

Required
$category_parent
int

Optional. ID of parent category.

Return Value

((int)
| WP_Error)

Function Information

Since Version
2.0.0
Source File
wp-admin/includes/taxonomy.php
Advertisement