On this page
tag_exists( int|string $tag_name ): mixed
Checks whether a post tag with a given name exists.
Parameters
$tag_nameint|string Required
Return
mixed Returns null if the term does not exist.
Returns an array of the term ID and the term taxonomy ID if the pairing exists.
Returns 0 if term ID 0 is passed to the function.
Source
File: wp-admin/includes/taxonomy.php. View all references
function tag_exists( $tag_name ) {
return term_exists( $tag_name, 'post_tag' );
}
Related
Uses
| Uses | Description |
|---|---|
| term_exists() wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/tag_exists