tag_exists( int|string $tag_name )

Check whether a post tag with a given name exists.

Parameters

$tag_name

(int|string) (Required)

Return

(mixed)

Source

File: wp-admin/includes/taxonomy.php

function tag_exists( $tag_name ) {
	return term_exists( $tag_name, 'post_tag' );
}

Changelog

Version Description
2.3.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/tag_exists