WordPress, by default, disables the inclusion of HTML Tags in Author Bios for security reasons. You can alter this measure to allow low-risk tags, like <a> and <i>, f.ex. for the use of Font Awesome. To do so, add (or alter) this snippet to your functions.php file, or via a Code Snippet Plugin.
In this code, <a>, <i>, <div>, <br>, <p>, <span>, and ‘class’ will be allowed in Author Bios.
// Remove default WordPress filtering
remove_filter('pre_user_description', 'wp_filter_kses');
// Add custom filtering to allow specific HTML tags with classes
add_filter('pre_user_description', 'custom_bio_kses');
function custom_bio_kses($content) {
$allowed_tags = array(
'a' => array(
'href' => array(),
'title' => array(),
'target' => array(),
'class' => array()
),
'i' => array(
'class' => array()
),
'strong' => array(
'class' => array()
),
'br' => array(),
'p' => array(
'class' => array()
),
'span' => array(
'class' => array()
),
'div' => array(
'class' => array()
)
);
return wp_kses($content, $allowed_tags);
}
Leave a Reply