tag_exists

Check whether a post tag with a given name exists.

Description

tag_exists( (string) $tag_name ); 

Parameters (1)

0. $tag_name (string)
The tag name.

Usage

  1. if ( !function_exists( 'tag_exists' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/taxonomy.php'; 
  3.  
  4. // The tag name. 
  5. $tag_name = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = tag_exists($tag_name); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/taxonomy.php  
  1. function tag_exists($tag_name) { 
  2. return term_exists($tag_name, 'post_tag');