tag_exists

The timeline below displays how wordpress function tag_exists has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

//
// Tags.
//
/**
 * Checks whether a post tag with a given name exists.
 *
 * @since 2.3.0
 *
 * @param int|string $tag_name
 * @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.
 */
function tag_exists($tag_name)
{
    return term_exists($tag_name, 'post_tag');
}

WordPress Version: 5.9

//
// Tags.
//
/**
 * Check whether a post tag with a given name exists.
 *
 * @since 2.3.0
 *
 * @param int|string $tag_name
 * @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.
 */
function tag_exists($tag_name)
{
    return term_exists($tag_name, 'post_tag');
}

WordPress Version: 5.4

//
// Tags.
//
/**
 * Check whether a post tag with a given name exists.
 *
 * @since 2.3.0
 *
 * @param int|string $tag_name
 * @return mixed
 */
function tag_exists($tag_name)
{
    return term_exists($tag_name, 'post_tag');
}

WordPress Version: 4.2

//
// Tags
//
/**
 * Check whether a post tag with a given name exists.
 *
 * @since 2.3.0
 *
 * @param int|string $tag_name
 * @return mixed
 */
function tag_exists($tag_name)
{
    return term_exists($tag_name, 'post_tag');
}

WordPress Version: 4.1

//
// Tags
//
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.3.0
 *
 * @param int|string $tag_name
 * @return mixed
 */
function tag_exists($tag_name)
{
    return term_exists($tag_name, 'post_tag');
}

WordPress Version: 3.7

//
// Tags
//
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.3.0
 *
 * @param unknown_type $tag_name
 * @return unknown
 */
function tag_exists($tag_name)
{
    return term_exists($tag_name, 'post_tag');
}