esc_attr_e() WordPress Function

The esc_attr_e() function is used to escape HTML attributes in WordPress. It is similar to the esc_attr() function, but also prints the escaped string.

esc_attr_e( string $text, string $domain = 'default' ) #

Display translated text that has been escaped for safe use in an attribute.


Description

Encodes < > & " ' (less than, greater than, ampersand, double quote, single quote). Will never double encode entities.

If you need the value for use in PHP, use esc_attr__().


Top ↑

Parameters

$text

(string)(Required)Text to translate.

$domain

(string)(Optional) Text domain. Unique identifier for retrieving translated strings.

Default value: 'default'


Top ↑

Source

File: wp-includes/l10n.php

function esc_attr_e( $text, $domain = 'default' ) {
	echo esc_attr( translate( $text, $domain ) );
}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.