Skip to content

Instantly share code, notes, and snippets.

@BryanBarrera
Last active April 24, 2016 00:07
Show Gist options
  • Save BryanBarrera/1fe1ee2e16712316e3247dc043cc34a8 to your computer and use it in GitHub Desktop.
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
<?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