WordPress at Your Fingertips
function is not described

wp_create_term() WP 2.8.0

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

No Hooks.

Return

Array|WP_Error.

Usage

wp_create_term( $tag_name, $taxonomy );
$tag_name(string) (required)
The term name.
$taxonomy(string)
The taxonomy within which to create the term.
Default: 'post_tag'

Changelog

Since 2.8.0 Introduced.

Code of wp_create_term() WP 5.8.2

function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) {
	$id = term_exists( $tag_name, $taxonomy );
	if ( $id ) {
		return $id;
	}

	return wp_insert_term( $tag_name, $taxonomy );
}