Summery Summery
Add a new term to the database if it does not already exist.
Syntax Syntax
Parameters Parameters
- $tag_name
-
(Required) The term name.
- $taxonomy
-
(Optional) The taxonomy within which to create the term. Default 'post_tag'.
Default value: 'post_tag'
Return Return
(array|WP_Error)
Source Source
File: wp-admin/includes/taxonomy.php
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 ); }
Advertisement
Changelog Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |