Last active
April 24, 2016 00:07
-
-
Save BryanBarrera/1fe1ee2e16712316e3247dc043cc34a8 to your computer and use it in GitHub Desktop.
Adds font awesome aria-hidden="true" to Wordpress allowed list of tags, mainly used to sanitize callback
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, | |
* we're also using wp_kses to allow font awesome 'aria-hidden' tag to be allowed | |
* | |
* @param int $input. | |
* @return int sanitizes html input to display output. force_balance_tags checks to see if any html tags are unclosed. | |
*/ | |
function html_sanitize_text($input) { | |
$filtered = wp_kses($unfiltered, $allowed_html, $allowed_protocols); | |
$allowed_html = array( | |
'i' => array( | |
'class' => array(), | |
'aria-hidden' => array() | |
), | |
); | |
return force_balance_tags( $input ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment