Hi there! I’ve stumbled across an issue where the HTML that works in the author box is coming up as text on the author page. It was working previously to upgrading to 6.1. I’ve got the WP HTML Author Bio plugin. Here’s an example article with the author box with working HTML, and here’s the author page where the HTML isn’t working.
Thanks so much in advance! We’re loving the theme.
WP strips out HTML in the author/bio box (“sanitizes”). This has always been the case. On many sites users are allowed to register, and HTML in ‘bios’ would be additional spam on the ‘author page.’
You have to modify the code, typically with functions.php to enable such functionality. Not theme related, specifically.
Try adding something like this to your functions.php file
in your theme folder, at bottom
//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');
After activating this snippet, the author bios can include p, br, and other HTML tags.
Warning
WordPress sanitizes user input for security reasons, not just to annoy you and make you go on a hunt to find this post to learn how to override the annoying setting.
If you’re considering disabling the WordPress sanitization, make sure you trust your users to not enter potentially harmful content into their profile bios. This includes iframes, forms, and more.
Welcome to WordPress! 🙂
-
This reply was modified 11 years by
simchris.
I actually already tried including those in functions.php, and it didn’t work.
Hi,
Please esc_html from author description in page-author-box.php – http://screencast.com/t/za0Ldx7lPAd – http://screencast.com/t/mGue4d7n and it should work – http://screencast.com/t/fEtCyv7qoVZx – http://screencast.com/t/EWlClIPNl
Thanks!
Yay! That worked, Alin! Thank you!
And thank you, Chris. I’m just grateful! 🙂
Can there be an option in a future theme update to allow HTML in the bios? This way we don’t have to re-edit page-author-box.php in the future.
If the setting could be set for specific users (or, turned on by default for admins only) that would be awesome.
Hi,
I have added this on our list and we will change this in a future update.
Thanks!
Hello,
Yes this was done and the bio info will accept html:
http://screencast.com/t/QBb9swSL – http://screencast.com/t/XgAT58eUSuPS
Thank you!
Hi,
Please update your theme to the latest version by following this guide: https://forum.tagdiv.com/how-to-update-the-theme-2/ and also: https://forum.tagdiv.com/how-to-update-visual-composer-plugin/
Thank you!
Hi,
I have shown a few screenshots in my previous reply here:
http://screencast.com/t/QBb9swSL – http://screencast.com/t/XgAT58eUSuPS it seems the strong tag works but p and br do not. You can give this a shot: https://premium.wpmudev.org/blog/enable-or-disable-all-html-tags-in-wordpress-author-biography-profiles/?npp=b&utm_expid=3606929-84.YoGL0StOSa-tkbGo-lVlvw.1&utm_referrer=https%3A%2F%2Fwww.google.ro%2F as the ‘sanitization’ comes from wordpress.
Thank you!
Did you read the guide I posted?
By default, WordPress strips some (but not all) HTML tags. You’re able to type all the HTML you want into the About Yourself –> Biographical Info text box for each WordPress profile, but HTML tags like p (new paragraph) and br (line break) get stripped once you click to save.
This is a wp issue, not a theme related issue. Please check the link I posted or a fix.
Thank you!
frustrated.. still dealing with this nightmare!!!
Running version 7.5 of newspaper:
/public_html/wp-content/themes/Newspaper/parts/page-author-box.php
<?php
if (!empty($part_cur_auth_obj->user_url)) {
echo '<div class="td-author-url">user_url) . '">' . esc_url($part_cur_auth_obj->user_url) . '</div>';
}
echo $part_cur_auth_obj->description;
?>
changed to Alin [tagDiv] #56809 Jun 29, 2015 at 3:02 pm suggestion:
http://www.screencast.com/t/za0Ldx7lPAd
This does NOT WORK!
Ok,
I’m not sure what does not work on your end but I tested this now in the current version and it works as expected. The author bio supports html: http://screencast.com/t/o0gcneu4u1
Please contact us via email at contact@tagdiv.com and provide wp-admin so we can login and investigate this issue. Also include a link to this conversation so we can identify you.
Thank you!
Thanks Bogdan,
I wasn’t interested in the bold or italic, I was interested in having <p> tags <br> tags etc.
For those interested, I researched this issue and even though it’s not tagdiv’s issue, I think we tagdiv team should at least offer some type of support other than saying it’s a wordpress issue.
At any rate, here’s what I did to get this issue resolved:
Located the functions.php file here:
…/wp-content/themes/Newspaper/functions.php
Add this line: remove_filter(‘pre_user_description’, ‘wp_filter_kses’);
Now there are <p> tags and <br> tags. The formatting now looks presentable instead of looking like a bunch of garbled crap.