WordPress.org

Forums

Author.php removes formatting (9 posts)

  1. AMSmith
    Member
    Posted 8 years ago #

    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:

    http://blog.mormonmomma.com/wordpress/author/alison-moore-smith/

    Here is how I want the formatting to look.

    http://blog.mormonmomma.com/wordpress/author-bios/alison-moore-smith/

    Any help greatly appreciated!

  2. AMSmith
    Member
    Posted 8 years ago #

    I'm desperate! Any ideas? Is the post making any sense or do I need to reword?

  3. AMSmith
    Member
    Posted 8 years ago #

    Anyone? :(

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

    <?php
    remove_filter('pre_user_description', 'wp_filter_kses');
    ?>
  5. AMSmith
    Member
    Posted 8 years ago #

    Otto42, thank you!

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

    <?php

    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?

  6. 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.

  7. AMSmith
    Member
    Posted 8 years ago #

    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.

  8. MajorD
    Member
    Posted 8 years ago #

    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.

  9. mrbill9999
    Member
    Posted 7 years ago #

    Worked like a champ - thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic