esc_attr_x

函式
esc_attr_x ( $text, $context, $domain = 'default' )
引數
  • (string) $text Text to translate.
    Required:
  • (string) $context Context information for the translators.
    Required:
  • (string) $domain Optional. Text domain. Unique identifier for retrieving translated strings. Default 'default'.
    Required:
    Default: 'default'
返回值
  • (string) Translated text.
定義位置
相關方法
esc_attr__esc_attr_eesc_attresc_html_xwp_kses_attr
引入
2.8.0
棄用
-

esc_attr_x: 這個函式用來轉義一個字串,以便在一個帶有翻譯和上下文的HTML屬性中使用。它接受一個字串、一個上下文和一個文字域作為引數,並返回轉義後的字串。

使用gettext上下文翻譯字串,並將其轉義以便在屬性中安全使用。

如果沒有翻譯,或者沒有載入文字域,則轉義原始文字並返回。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function esc_attr_x( $text, $context, $domain = 'default' ) {
return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
}
function esc_attr_x( $text, $context, $domain = 'default' ) { return esc_attr( translate_with_gettext_context( $text, $context, $domain ) ); }
function esc_attr_x( $text, $context, $domain = 'default' ) {
	return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
}

常見問題

FAQs
檢視更多 >