Allow html in user description

If you find this free website useful – why don’t you support this with a donation? It is easy…. read more ….

The WordPress user bio only allows a very restricted set html. Occasionally, it is desirable to be able to format the WordPress user bio with additional html.  Out of the box that is not possible.

However to allow additional html in the WordPress user bio, like I have with some <p> and <br> to break things up it is fairly easy to do.



Add the following code to your theme’s functions.php file.

//disable WordPress sanitization to allow more than just $allowedtags from /wp-includes/kses.php
remove_filter('pre_user_description', 'wp_filter_kses');
//add sanitization for WordPress posts
add_filter( 'pre_user_description', 'wp_filter_post_kses');

And then you will be able to add html to your user bio on WordPress.




, , ,




Leave a Reply

Your email address will not be published. Required fields are marked *