tag_exists( int|string $tag_name ): mixed

Checks whether a post tag with a given name exists.


Parameters

$tag_name int|string Required

Top ↑

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.


Top ↑

Source

File: wp-admin/includes/taxonomy.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.