# esc_html_x()

URL: https://chugunov.pro/api-wordpress/functions/esc_html_x/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 2.9.0.

## Сигнатура

```php
esc_html_x( string $text, string $context, string $domain = 'default' ): string
```

## Описание

Если перевода нет или текстовый домен не загружен, исходный текст экранируется и возвращается.

## Параметры

- `$text` `string` — обязательный. Текст для перевода.
- `$context` `string` — обязательный. Контекстная информация для переводчиков.
- `$domain` `string` — необязательный, по умолчанию `'default'`. Текстовый домен. Уникальный идентификатор для получения переведённых строк.
  
  Значение по умолчанию: 'default'.

## Возвращаемое значение

`string`

## Исходный код

Файл: `wp-includes/l10n.php:459`

```php
function esc_html_x( $text, $context, $domain = 'default' ) {
	return esc_html( translate_with_gettext_context( $text, $context, $domain ) );
}
```

## История изменений

- 2.9.0 — Introduced.

## Связанные

Использует: [`translate_with_gettext_context`](https://chugunov.pro/api-wordpress/functions/translate_with_gettext_context/), [`esc_html`](https://chugunov.pro/api-wordpress/functions/esc_html/).
Используется в: `Plugin_Installer_Skin::do_overwrite`, `Theme_Installer_Skin::do_overwrite`, `WP_Customize_Manager::render_control_templates`, [`wp_image_editor`](https://chugunov.pro/api-wordpress/functions/wp_image_editor/), [`_admin_notice_post_locked`](https://chugunov.pro/api-wordpress/functions/_admin_notice_post_locked/), `Custom_Image_Header::step_1`, `Custom_Background::admin_page`, [`wp_print_media_templates`](https://chugunov.pro/api-wordpress/functions/wp_print_media_templates/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/esc_html_x/
