esc_attr

The WordPress Core esc attr function.

Description

esc_attr(); 

Usage

  1. if ( !function_exists( 'esc_attr' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/noop.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = esc_attr(); 
  7.  

Defined (3)

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

/wp-admin/includes/noop.php  
  1. function esc_attr() {} 
/wp-includes/formatting.php  
  1. function esc_attr( $text ) { 
  2. $safe_text = wp_check_invalid_utf8( $text ); 
  3. $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); 
  4. /** 
  5. * Filters a string cleaned and escaped for output in an HTML attribute. 
  6. * Text passed to esc_attr() is stripped of invalid or special characters 
  7. * before output. 
  8. * @since 2.0.6 
  9. * @param string $safe_text The text after it has been escaped. 
  10. * @param string $text The text prior to being escaped. 
  11. */ 
  12. return apply_filters( 'attribute_escape', $safe_text, $text ); 
/wp-includes/l10n.php  
  1. function esc_attr__( $text, $domain = 'default' ) { 
  2. return esc_attr( translate( $text, $domain ) );