函数原型
esc_attr_x( string $text, string $context, string $domain = ‘default’ ): string
函数描述
Translates string with gettext context, and escapes it for safe use in an attribute.
是否弃用
未弃用
函数参数
-
$text
string
Required - Text to translate.
-
$context
string
Required - Context information for the translators.
-
$domain
string
Optional - Text domain. Unique identifier for retrieving translated strings.
Default'default'.Default:
'default'
函数返回值
string Translated text.
函数位置
File: wp-includes/l10n.php.
函数源码
function esc_attr_x( $text, $context, $domain = 'default' ) {
return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |

