Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

the_author_meta is stripping out HTML code WordPress


Is there a way to prevent the_author_meta() from stripping out HTML?

I am working on a site for a client that has anywhere from 6-10 authors each with their own profiles and descriptions. The bio's are multiple paragraphs and currently all the text is being dumped into a single paragraph and it is stripping out some href's that I have in there.

Is there a way to echo this out without affecting the HTML code?

Answers (2)


Baki Goxhaj answers:

Auto-praragraph the content like this:

echo wpautop( $author_bio );

Dan | gteh comments:

Sorry that does not work.

If I use just

echo wpautop( $author_bio);
then nothing gets displayed.

I tried these two below and the text is still not formatted.

echo wpautop( the_author_meta('description'));
$author_bio = the_author_meta('description'); echo wpautop( $author_bio );

Also that wouldn't address stripping out <a hrefs> as well

Baki Goxhaj comments:

$author_bio was a samle var for you to get the idea, not to be used as is. The function only puts paragraph tags around the spaces you leave in the original content.

Baki Goxhaj comments:

get_userdata() seems the right function for you.

Dan | gteh comments:

Right. I understood that afterward which is why I tried assigning the_author_meta('description) to $author_bio but despite the spaces in the text, no <p> tags were wrapped around them

Dan | gteh comments:

I appreciate the help. I've voted 75/25 in favour of Christianto as his suggestion was closer to what I needed without having to do too much extra work.


Christianto answers:


have you tried to retrieve user description object with [[LINK href=""]]get_userdata[[/LINK]] instead of using the_author_meta?

Dan | gteh comments:

That worked to an extent, but I needed to retrieve the current author's ID and pass it to that function since it requires an ID to work rather than just pulling in the author from the loop.

I decided to go another route for now but thanks for the answers.