esc_html() does two things:
- Checks for invalid UTF8 in a string.
- Converts a number of special characters into their HTML entities, specifically deals with: &, <, >, “, and ‘.
Using it instead of __()
, _e
and other i18n functions protects your website from possible errors that can occur with unaware translators who may use text that contains (1) invalid UTF8 characters or (2) unwanted HTML code. Trust me, many translators will be tempted to use some ‘nice’ HTML tags like <i>
, <b>
etc, even worse, they won’t close them correctly.
Related Posts:
- How to redirect all HTTP requests to HTTPS
- What’s the best approach for generating a new API key?
- Simplest two-way encryption using PHP
- How does the SQL injection from the “Bobby Tables” XKCD comic work?
- how fix “this certificate cannot be verified up to a trusted certification authority”
- How can bcrypt have built-in salts?
- Getting a List of Currently Available Roles on a WordPress Site?
- What’s the easiest way to stop WP from ever logging me out
- Prevent access or auto-delete readme.html, license.txt, wp-config-sample.php
- How safe / sanitized is wp_insert_posts()?
- From a security standpoint, should bloginfo() or get_bloginfo() be escaped?
- Why are passwords exportable as plain text in WordPress?
- What’s the difference between esc_* functions?
- How to set up fail2ban with WordFence?
- How to remove “Connection Information” requirement on localhost install of WP on MACOSX
- Disable comment windows for all existing posts (pages/blogposts)
- WordPress “Site Health Status” trust it or myself for its security advice?
- Generate WordPress salt
- Stop wordpress automatically escaping $_POST data
- Is WP vulnerable when updating plugins or themes?
- how can i embed wordpress backend in iframe
- Garbage in beginning of wp-config.php – was this WP installation compromised?
- Can I force a password change?
- What is the relationship between cURL, WordPress and cacert.pem?
- Is it necessary to use esc_url with template tags such as get_permalink?
- What is pclzip.lib.php file that wordfence think it’s a malicious code
- How to prevent bot or someone to modify any file automatically?
- How to disable XML-RPC from Linux command-line in a total way?
- HTTP Security Headers in wp-config
- How to remove javascript malware in wordpress site [closed]
- Staging Site: Made Public – Security Questions
- Best Way to Enable Two Step Authentication
- Securing my WordPress Files and Directories
- Single sign-on: wp_authenticate_user vs wp_authenticate
- Securing a multi-user permission structure
- Is default functions like update_post_meta safe to use user inputs?
- No option “I would like my site to be private, visible only to users I choose” in Privacy Settings
- How does the “authentication unique keys and salts” feature work?
- vs WordPress Security
- esc_html__ security : what for in this example?
- Securing wp-config leads to sensitive information leak on wp-settings
- Suspicious Files
- What’s the point of forbidding access to wp-config.php?
- wp-json and what data does it give away?
- Is is necessary to use security plugin for wordpress? [closed]
- neccessary?
- wp-config.php being written by attacker
- Simple Online Payment for Event Registration [closed]
- What may be causing failure of auto-install features in WordPress (v3.0.3)?
- Client side HTTP parameter pollution (reflected)
- Local file inclusion critical security issue [closed]
- my wordpress website is suspended [closed]
- Malware script in database post table only? [closed]
- Best practices to assert current_user_can() with guests
- XMLRPC slow and weird websites/services
- iTheme Security always lockout my account [closed]
- Is it sensible to worry about sanitizing admin input in plugin custom CSS?
- WordPress Front end Form – Enable to Submit PHP Codes
- Is it safe use wp_editor in public contact form
- Is WordPress MultiSite secure & how much can it scale? [closed]
- How to find exploited wordpress plugin [closed]
- How I can open back door for myself?
- How safe is current_user_can()?
- Is it safe to give wordpress directories ownership to www-data?
- Do we need to escape data that we receive from theme options?
- Why does WordPress change a file’s permissions?
- Side effects of disallowing *.php requests in production environment?
- Outgoing new connection to linked Websites – why?
- My Site keeps crashing due to the wp-confg file being deleted
- Someone keeps changing my SITEURL (mysql injection or xss?) [closed]
- Who updates the wp-admin/core file?
- How WordPress sanitizes post content on save? Or it doesn’t?
- Replace domain in database
- Does this code indicate an exploit?
- What highest security brake with wordpress and static files?
- Spam in WordPress root folder
- Has anyone developed a anti-spam plugin to simply allow users to BLOCK whatever they wish to, but one that will also go easy on IP addresses?
- HSTS header not being added correctly
- how to protect wordpress content from crawler
- Should I worry about SQL injection when using REST API?
- How can I backup my site if it gets hacked?
- Cannot access wp admin of WordPress website (security plugin issue) [closed]
- Why are the latest visits to my website originating from my own website?
- Secure Multiple WordPress Installations on shared hosting
- How do I hide WordPress users from security scanning?
- Background Updates Not Happening
- wp-config.php file and code injection
- Able to go to WordPress admin even after deleting auth cookies from request headers
- FORCE_SSL_ADMIN affecting subdomains
- What is the best security $_POST method?
- Should WordPress Add Options to Enhance Security or Leave it to plugin developers? [closed]
- Bank account number and Sort Code in a form [closed]
- Directory to store secure file
- How can I give someone server access to only duplicate and modify a site?
- WP-JSON: Cross Origin Resource Sharing Vulnerability?
- How can I implement ansible with per-host passwords, securely?
- Why should I firewall servers?
- Does drilling a hole into a hard drive suffice to make its data unrecoverable?
- Can you alter the default wordpress strong password requirements?
- how to sanitizing $_POST with the correct way?