Author Page

Posted in: Newspaper
Post count: 3

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.

Post count: 9544

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.
Post count: 9544

The plugin you reference is outdated and should not be used.

Post count: 3

I actually already tried including those in functions.php, and it didn’t work.

Post count: 7909

Hi,

Please esc_html from author description in page-author-box.phphttp://screencast.com/t/za0Ldx7lPAdhttp://screencast.com/t/mGue4d7n and it should work – http://screencast.com/t/fEtCyv7qoVZxhttp://screencast.com/t/EWlClIPNl

Thanks!

Post count: 9544

Apologies; my suggested code applies to over-ride the “default” WP comments box, and not a customized version as used with theme (doh). 🙂

Post count: 3

Yay! That worked, Alin! Thank you!

And thank you, Chris. I’m just grateful! 🙂

Post count: 36

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.

Post count: 7909

Hi,

I have added this on our list and we will change this in a future update.

Thanks!

Post count: 64

Hi,

RE: 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.

Was this done?

Post count: 22421

Hello,
Yes this was done and the bio info will accept html:
http://screencast.com/t/QBb9swSLhttp://screencast.com/t/XgAT58eUSuPS
Thank you!

Post count: 64

Hi Bogdan,

I tried using <BR> and <p> tags and both are being stripped out, making the bio look like a bunch garble text.

Suggestions please?

Thank you
JR

Post count: 22421

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!

Post count: 64

Hi Bogdan,

Both were already done before my posting. I double checked to be sure, so to confirm, I do have the latest 7.4 with all of the updates, but still the <p> tag isn’t working. It’s being stripped out.

Regards,
JR

Post count: 22421

Hi,

I have shown a few screenshots in my previous reply here:
http://screencast.com/t/QBb9swSLhttp://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!

Post count: 64

So we’re back to square 1 as your suggestion is what Chris suggested above on Jun 28, 2015 at 6:47 pm

Really not sure why not simply adding a <p> or <br> tag is so complicated when you’ve added and even links?

Post count: 22421

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!

Post count: 64

Yes, I read the post and I’m just going back to square 1 🙂

Post count: 64

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!

Post count: 22421

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!

Post count: 64

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.

Post count: 30

Works for me. Thank you!

Viewing 22 posts - 1 through 22 (of 22 total)
The forum ‘Newspaper’ is closed to new topics and replies.