esc_attr__()WP 2.8.0

Translates the text using esc_attr().

Encodes < > & " ' (greater than, less than, ampersand, double and single quotes) characters. Does not make double escaping.

Always use this function as a filter for form data (input):

<input type="text" value="<?php echo esc_attr__( 'Default value', 'textdomain' ) ?>">
Uses: esc_attr()

No Hooks.


String. Translated text on success, original text on failure.


esc_attr__( $text, $domain );
$text(string) (required)
Text to translate.
Text domain. Unique identifier for retrieving translated strings.
Default: 'default'


#1 Title within the loop

<h2 class="entry-title">
	  <a href="<?php the_permalink(); ?>" 
			title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" 
			rel="bookmark"><?php the_title(); ?></a>


Since 2.8.0 Introduced.

Code of esc_attr__() WP 6.0

function esc_attr__( $text, $domain = 'default' ) {
	return esc_attr( translate( $text, $domain ) );