WordPress.org

Ready to get started?Download WordPress

Forums

the_content() and the <p> tag (4 posts)

  1. gkp99
    Member
    Posted 4 years ago #

    Hi,

    It seems that the_content() function always flanks the contents with <p> tags. I am embedding the text in the_content() within a div but I don't want the leading <p> tag. Is there anyway to remove the first <p> and </p> tags? I still want to preserve the paragraph breaks within the text however,

    Can this be done?

    Thanks,

    Garry

  2. @mercime
    Volunteer Moderator
    Posted 4 years ago #

  3. nashio
    Member
    Posted 4 years ago #

    tthats right 'the_content_rss' will remove the <p>

  4. Electric Studio
    Member
    Posted 4 years ago #

    Or, you can add

    <?php remove_filter ('the_content', 'wpautop'); ?>

    At the top of the template where you don't want to show the_content in a P tag

Topic Closed

This topic has been closed to new replies.

About this Topic