WPDev.one
Core Function
View Source on Trac ↗

wp_create_term()

wp_create_term( mixed $tag_name, mixed $taxonomy = 'post_tag' )

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

Parameters 1 required

Name / Type Description
$tag_name
string

The term name.

Required
$taxonomy
string

Optional. The taxonomy within which to create the term. Default 'post_tag'.

Return Value

((array)
| WP_Error)

Function Information

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