# esc_html()

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

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

## Сигнатура

```php
esc_html( string $text ): string
```

## Описание

Экранирование для HTML-блоков.

## Параметры

- `$text` `string` — обязательный

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

`string`

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

Файл: `wp-includes/formatting.php:4680`

```php
function esc_html( $text ) {
	$safe_text = wp_check_invalid_utf8( $text );
	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
	/**
	 * Filters a string cleaned and escaped for output in HTML.
	 *
	 * Text passed to esc_html() is stripped of invalid or special characters
	 * before output.
	 *
	 * @since 2.8.0
	 *
	 * @param string $safe_text The text after it has been escaped.
	 * @param string $text      The text prior to being escaped.
	 */
	return apply_filters( 'esc_html', $safe_text, $text );
}
```

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

- 2.8.0 — Introduced.

## Связанные

Использует: [`wp_check_invalid_utf8`](https://chugunov.pro/api-wordpress/functions/wp_check_invalid_utf8/), [`_wp_specialchars`](https://chugunov.pro/api-wordpress/functions/_wp_specialchars/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: `WP_Connector_Registry::unregister`, `WP_Connector_Registry::get_registered`, `WP_Connector_Registry::register`, [`wp_options_connectors_render_page`](https://chugunov.pro/api-wordpress/functions/wp_options_connectors_render_page/), [`wp_font_library_render_page`](https://chugunov.pro/api-wordpress/functions/wp_font_library_render_page/), `WP_AI_Client_Prompt_Builder::using_abilities`, [`wp_register_ability_category`](https://chugunov.pro/api-wordpress/functions/wp_register_ability_category/), [`wp_register_ability`](https://chugunov.pro/api-wordpress/functions/wp_register_ability/), [`_block_bindings_term_data_get_value`](https://chugunov.pro/api-wordpress/functions/_block_bindings_term_data_get_value/), `WP_Abilities_Registry::register`, `WP_Abilities_Registry::unregister`, `WP_Abilities_Registry::get_registered`, `WP_Ability_Categories_Registry::register`, `WP_Ability_Categories_Registry::unregister`, `WP_Ability_Categories_Registry::get_registered`, `WP_Ability::validate_input`, `WP_Ability::invoke_callback`, `WP_Ability::check_permissions`, `WP_Ability::do_execute`, `WP_Ability::validate_output`, `WP_Ability::execute`, `WP_Ability_Category::__construct`, `WP_Ability::__construct`, `WP_Speculation_Rules::add_rule`, `WP_URL_Pattern_Prefixer::prefix_path_pattern`, [`wp_render_empty_block_template_warning`](https://chugunov.pro/api-wordpress/functions/wp_render_empty_block_template_warning/), `WP_Block_Metadata_Registry::register_collection`, `WP_Site_Health::get_test_autoloaded_options`, `WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies`, `WP_Interactivity_API_Directives_Processor::set_content_between_balanced_tags`, `WP_Interactivity_API::data_wp_text_processor`, `WP_Plugin_Install_List_Table::get_more_details_link`, `WP_Plugin_Install_List_Table::get_dependencies_notice`, `WP_Plugins_List_Table::get_view_details_link`, `WP_REST_Global_Styles_Controller::validate_custom_css`, [`wp_required_field_indicator`](https://chugunov.pro/api-wordpress/functions/wp_required_field_indicator/), `WP_List_Table::get_views_links`, `WP_Theme_JSON::remove_insecure_settings`, `WP_Theme_JSON::is_safe_css_declaration`, [`wp_maybe_inline_styles`](https://chugunov.pro/api-wordpress/functions/wp_maybe_inline_styles/).

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