Adds a new tag to the database if it does not already exist.
$tag_nameint|stringrequired
function wp_create_tag( $tag_name ) {
return wp_create_term( $tag_name, 'post_tag' );
}
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_create_tag