Title: esc_html_e
Published: April 25, 2014
Last modified: February 24, 2026

---

# esc_html_e( string $text, string $domain )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#wp--skip-link--target)

Displays translated text that has been escaped for safe use in HTML output.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#description)󠁿

If there is no translation, or the text domain isn’t loaded, the original text is
escaped and displayed.

If you need the value for use in PHP, use [esc_html__()](https://developer.wordpress.org/reference/functions/esc_html__/).

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#parameters)󠁿

 `$text`stringrequired

Text to translate.

`$domain`stringoptional

Text domain. Unique identifier for retrieving translated strings.
 Default `'default'`.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#source)󠁿

    ```php
    function esc_html_e( $text, $domain = 'default' ) {
    	echo esc_html( translate( $text, $domain ) );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/l10n.php#L388)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/l10n.php#L388-L390)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#related)󠁿

| Uses | Description | 
| [translate()](https://developer.wordpress.org/reference/functions/translate/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  |

| Used by | Description | 
| [wp_enqueue_block_template_skip_link()](https://developer.wordpress.org/reference/functions/wp_enqueue_block_template_skip_link/)`wp-includes/theme-templates.php` |

Enqueues the skip-link script & styles.

  | 
| [the_block_template_skip_link()](https://developer.wordpress.org/reference/functions/the_block_template_skip_link/)`wp-includes/deprecated.php` |

Prints the skip-link script & styles.

  | 
| [WP_Privacy_Data_Removal_Requests_List_Table::column_next_steps()](https://developer.wordpress.org/reference/classes/wp_privacy_data_removal_requests_list_table/column_next_steps/)`wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php` |

Outputs the Next steps column.

  | 
| [WP_Privacy_Data_Export_Requests_List_Table::column_next_steps()](https://developer.wordpress.org/reference/classes/wp_privacy_data_export_requests_list_table/column_next_steps/)`wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php` |

Displays the next steps column.

  | 
| [WP_Widget_Custom_HTML::render_control_template_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/render_control_template_scripts/)`wp-includes/widgets/class-wp-widget-custom-html.php` |

Render form template scripts.

  | 
| [WP_Customize_Date_Time_Control::content_template()](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/content_template/)`wp-includes/customize/class-wp-customize-date-time-control.php` |

Renders a JS template for the content of date time control.

  | 
| [WP_Widget_Text::render_control_template_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_text/render_control_template_scripts/)`wp-includes/widgets/class-wp-widget-text.php` |

Renders form template scripts.

  | 
| [WP_Widget_Media::render_control_template_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_media/render_control_template_scripts/)`wp-includes/widgets/class-wp-widget-media.php` |

Render form template scripts.

  | 
| [WP_Widget_Media_Image::render_control_template_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_media_image/render_control_template_scripts/)`wp-includes/widgets/class-wp-widget-media-image.php` |

Render form template scripts.

  | 
| [print_embed_sharing_dialog()](https://developer.wordpress.org/reference/functions/print_embed_sharing_dialog/)`wp-includes/embed.php` |

Prints the necessary markup for the embed sharing dialog.

  | 
| [WP_Customize_Manager::render_control_templates()](https://developer.wordpress.org/reference/classes/wp_customize_manager/render_control_templates/)`wp-includes/class-wp-customize-manager.php` |

Renders JS templates for all registered control types.

  | 
| [wp_print_revision_templates()](https://developer.wordpress.org/reference/functions/wp_print_revision_templates/)`wp-admin/includes/revision.php` |

Print JavaScript templates required for the revisions experience.

  | 
| [WP_Media_List_Table::views()](https://developer.wordpress.org/reference/classes/wp_media_list_table/views/)`wp-admin/includes/class-wp-media-list-table.php` |

Overrides parent views to use the filter bar display.

  | 
| [network_step1()](https://developer.wordpress.org/reference/functions/network_step1/)`wp-admin/includes/network.php` |

Prints step 1 for Network installation process.

  | 
| [network_step2()](https://developer.wordpress.org/reference/functions/network_step2/)`wp-admin/includes/network.php` |

Prints step 2 for Network installation process.

  | 
| [wp_image_editor()](https://developer.wordpress.org/reference/functions/wp_image_editor/)`wp-admin/includes/image-edit.php` |

Loads the WP image-editing interface.

  | 
| [confirm_delete_users()](https://developer.wordpress.org/reference/functions/confirm_delete_users/)`wp-admin/includes/ms.php` |  | 
| [wp_print_media_templates()](https://developer.wordpress.org/reference/functions/wp_print_media_templates/)`wp-includes/media-template.php` |

Prints the templates used in the media manager.

  |

[Show 13 more](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#comment-content-2413)
 2.    [Mahesh Waghmare](https://profiles.wordpress.org/mahesh901122/)  [  8 years ago  ](https://developer.wordpress.org/reference/functions/esc_html_e/#comment-2413)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F%23comment-2413)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F%23comment-2413)
 4.  Escape & Echo (Display) the translated text.
 5.      ```php
         <h1><?php esc_html_e( 'Title', 'text-domain' )?></h1>
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F%3Freplytocom%3D2413%23feedback-editor-2413)
 7.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/esc_html_e/?output_format=md#comment-content-7289)
 8.    [Mehraz Morshed](https://profiles.wordpress.org/mehrazmorshed/)  [  1 year ago  ](https://developer.wordpress.org/reference/functions/esc_html_e/#comment-7289)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F%23comment-7289)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F%23comment-7289)
 10. **[esc_html()](https://developer.wordpress.org/reference/functions/esc_html/) **
     is for escaping.
      **[esc_html__()](https://developer.wordpress.org/reference/functions/esc_html__/)**
     is for translating and escaping. **[esc_html_e()](https://developer.wordpress.org/reference/functions/esc_html_e/)**
     is for translating, escaping and directly echoing
 11.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F%3Freplytocom%3D7289%23feedback-editor-7289)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_html_e%2F)
before being able to contribute a note or feedback.