Support » Themes and Templates » WordPress is adding a “<p>” before the page’s content

WordPress is adding a “<p>” before the page’s content

  • I can’t change it: though, this “” is not anywhere in my templates, WordPress simply adds it. Right before the content starts.

    But this spoils my CSS design.

    Where can I change this?



Viewing 8 replies - 1 through 8 (of 8 total)
  • Link to your blog would be necessary for anyone to tell you what’s going on.

    Hello Stefancom,

    This is due to the wpautop filter that runs behind the scenes without most users knowing about it.

    You can either run the command

    remove_filter(‘the_content’, ‘wpautop’);

    at some point before you call the_content(); in the loop, or you can replace

    <?php the_content(); ?>


    <?php echo $post->post_content; ?>

    You should be aware that using the second method bypasses all filters that any plugins run before displaying your content. I believe Markdown and other similar plugins are run at this time, so you may want to use the remove_filter option if you rely on this type of plugin.

    Is it possible to use CSS to style the p tag…

    margin:0px 0px 0px 0px;
    padding:0px 0px 0px 0px;

    …or something like that.

    I see that problem with all these format stuff. Now, also “<br>” signs are gone…

    But well, maybe I can write them myself into the contentpages.

    No chance, just to take away “” and keep the rest?


    In the settings you can change the main text entry box to be more simplified instead of the real time display deal. When you do this it seems that the p tags are not automatically added. Also I believe returns are added such as (‘\\n’ aka: chr(13)). The breaks can and prabably should be added later anyway, using a javascript or php function which will replace the return character with a br tag.

    what if i want to remove all of <p> and </p> which is on the database to be not represented in the sites. Because it ruins the website presentation.

    in what file should I add str_replace() for this function ?


Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WordPress is adding a “<p>” before the page’s content’ is closed to new replies.
Skip to toolbar