Title: Escaping hardcoded strings
Last modified: February 27, 2020

---

# Escaping hardcoded strings

 *  [marcinos06](https://wordpress.org/support/users/marcinos06/)
 * (@marcinos06)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/escaping-hardcoded-strings/)
 * Hi there
    Is there any specific reason why we should be escaping hardcoded strings?
   For example: `echo esc_html__( 'There are no posts created yet', 'textdomain');`

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [marcinos06](https://wordpress.org/support/users/marcinos06/)
 * (@marcinos06)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/escaping-hardcoded-strings/#post-12486374)
 * The reason I’m asking about this is that Theme Sniffer returns warning for this.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/escaping-hardcoded-strings/#post-12488161)
 * Not if there are no chars in the string that would need to be escaped. The WP
   code verifies valid UTF-8 encoding and escapes `& < > " ‘` chars. If **you are
   sure*** neither applies to your string, then there is no point in escaping, it
   will not change anything.
 * *However, you have no idea how your string might get translated, so your “hardcoded
   string” is in effect a variable in your example, so it should be run through 
   an escape function.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Escaping hardcoded strings’ is closed to new replies.

## Tags

 * [escaping](https://wordpress.org/support/topic-tag/escaping/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/escaping-hardcoded-strings/#post-12488161)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
