wp_create_tag() WordPress Function
The wp_create_tag() function allows you to create a new tag within Wordpress. This function takes two parameters: the name of the tag, and the slug for the tag. The name of the tag is the name that will be displayed for the tag, while the slug is the URL-friendly version of the name.
wp_create_tag( int|string $tag_name ) #
Add a new tag to the database if it does not already exist.
Parameters
- $tag_name
(int|string)(Required)
Return
(array|WP_Error)
Source
File: wp-admin/includes/taxonomy.php
function wp_create_tag( $tag_name ) { return wp_create_term( $tag_name, 'post_tag' ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |