Last active
April 22, 2016 17:19
-
-
Save BryanBarrera/dbd8aea90bdbbf13f3c61bd11e24868e to your computer and use it in GitHub Desktop.
Sanitize HTML
This file contains 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
<?php | |
/** | |
* The force_balance_tags() function ensures that no tags are left unclosed, | |
* while the wp_kses_post() ensures that only safe tags make it into the database | |
* (the same tags that are allowed in a standard WordPress post.) | |
* @param int $input. | |
* @return int sanitizes html input to display output. force_balance_tags checks to see if any html tags are unclosed. | |
*/ | |
function example_sanitize_text( $input ) { | |
return wp_kses_post( force_balance_tags( $input ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment