WordPress by default stripes out HTML formatting from the Author’s Bio in profiles due to the possibilities of malicious activities from any author level users. However, you may need this if you trust your authors and show the author bio in their posts to give the credit they deserves.
When I searched on Google for how to allow html in author bio, I got results which deal with editing one of the core WordPress file ‘wp-includes/user.php‘. This has two drawbacks, first, you will lost the customization whenever you upgrade WordPress and second, this poses a major security risk as all type of HTML formatting will be possible within the author bio.
I played with the WordPress functions plus searched for some alternative solution and I found a working solution which doesn’t need editing of any WordPress core file. All you need is adding two lines of code in your theme’s ‘functions.php‘ file.
Open your theme’s functions.php file and add these lines just before the closing php tag (?>).
remove_filter('pre_user_description', 'wp_filter_kses'); add_filter( 'pre_user_description', 'wp_filter_post_kses' );
The first line totally removes the stripping of html formatting from the description (bio) field and the second line sanitize content for allowed HTML tags for post content. Once you put this up, you can go and use all the HTML formatting allowed in posts in author’s bio.
If you don’t want to edit the theme file, here I have made a plugin for you. Just upload the folder in your ‘wp-plugin’ folder and activate it from plugins menu.
{ 5 comments… read them below or add one }
Hi
Its really gr8
I am using Thesis Theme in Wordpress. Can I use this ?
Code works in 3.31 using http://codex.wordpress.org/Must_Use_Plugins will probly work in a child theme functions file as well. – thanks
“Discover The Power Of WordPress�?NOT “rocket science�? language�? dress bitter
Great Job Abhik, nothing worked, till i tried yours. Thanks alot.
Greetz from Germany.
Taco
That’s a nice feature… thanks for sharing