tag_escape

Escape an HTML tag name.

Description

(string) tag_escape( (string) $tag_name ); 

Returns (string)

Parameters (1)

0. $tag_name (string)
The tag name.

Usage

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

Defined (1)

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

/wp-includes/formatting.php  
  1. function tag_escape( $tag_name ) { 
  2. $safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) ); 
  3. /** 
  4. * Filters a string cleaned and escaped for output as an HTML tag. 
  5. * @since 2.8.0 
  6. * @param string $safe_tag The tag name after it has been escaped. 
  7. * @param string $tag_name The text before it was escaped. 
  8. */ 
  9. return apply_filters( 'tag_escape', $safe_tag, $tag_name );