Created
January 29, 2019 03:50
-
-
Save junaidtk/3ab5f5b25fb8857868aa41e0e921f9d7 to your computer and use it in GitHub Desktop.
wordpresss esc_html and its reverse opperation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esc_html(): | |
It is wordpress function used to convert the html element to html entity. | |
Refer the below eg: | |
$html = esc_html( '<a href="http://www.example.com/">A link</a>' ); | |
so $html contain | |
<a href="http://www.example.com/">A link</a> | |
The output will display like below. | |
<a href="http://www.example.com/">A link</a> | |
In-order to decode the text from esc_html(), we can use below wp function | |
wp_specialchars_decode(); | |
In order to remove the html tags from a string we can use below php function. | |
strip_tags($text); | |
In order to remove the esc_html functionality we can use the below filter. | |
apply_filters( 'esc_html', $safe_text, $text ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment