Support » Fixing WordPress » Author.php removes formatting

  • I’m trying to set up author pages to include bios of the writers for my blog. The author page dumps the “About the user” field in Users>Authors & Users into the Details section in my author.php.

    The problem is that the “About the user” field is stripped of HTML. It keeps HTML links and bold formatting, but removes all paragraph markings. Without such HTML being accepted, it leaves me with huge chunks of hard-to-read text.

    Is there a way to get the “About the user” field to KEEP the paragraph markings?

    Here is how the author.php sets up this section:

    Here is how I want the formatting to look.

    Any help greatly appreciated!

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’m desperate! Any ideas? Is the post making any sense or do I need to reword?

    Anyone? 🙁

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Author descriptions are filtered through the kses filter when you save the user. kses only allows certain tags.

    To disable this behavior, add this to your theme’s functions.php file, after the <?php line:
    remove_filter('pre_user_description', 'wp_filter_kses');

    If you have no functions.php file in your theme’s directory, make one and add this to it instead:

    remove_filter('pre_user_description', 'wp_filter_kses');

    Otto42, thank you!

    I do have a functions.php file, but it has multiple lines that begin with


    I tried to place the code in a few places within those tags, but couldn’t get the page to change. Am I placing it wrong?

    As I look at this, however, I think the solution has to come from the core. When I put HTML into the “About Yourself” field, and save, the paragraph markers disappear. The are stripped out by WP when saved, not when the page is created.

    Can’t figure out why this would be done. Is there a way to enter them that won’t be removed?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I tried to place the code in a few places within those tags, but couldn’t get the page to change.

    The page isn’t going to change just from adding a line.

    That HTML code you put in the about me field is *gone*. It was never saved in the first place. It got filtered before being saved. This line of code I’m telling you to add will disable that filter so that the page will actually save your HTML.

    So after you put this line in (immediately after the very first “<?php” in the functions.php file in your theme’s directory… NOT the functions.php in the wp-includes directory!), go back to the users admin page and edit the About stuff to be correct again and save it. *Then* it will show up.

    Yes, I knew that. 🙂 I did go back and put the HTML back in before I tested it. And I did edit the correct file. I did not, however, put it in the right place.

    Now, when I save, the formatting is intact.

    However, another problem has appeared. Ah, but I fixed it in the author.php file.

    Otto, thank you for your time and expertise. Your assistance has been invaluable and I sincerely appreciate it.

    What HTML is used to create line breaks such as
    ? I’ve tried both
    and <p> and the HTML is still getting stripped after adding the suggested code to my theme’s /theme/mytheme/functions.php.

    Worked like a champ – thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Author.php removes formatting’ is closed to new replies.