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' ) ?>">

No Hooks.

Return

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

Usage

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

Examples

1

#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>
</h2>

Changelog

Since 2.8.0 Introduced.

esc_attr__() code WP 6.5.2

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