Function: wp_create_category

wp_create_category( integer | string $cat_name, integer $parent )

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

Shortcut: wcc

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$cat_name integer | string
$parent integer

Returns

integer | WP_Error

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.