From my Googling, it appears as though the default behavior in Wordpress is to add paragraphs automatically, but in the HTML view, regardless of what style I choose in the Visual Editor's style drop-down (paragraph, for example), paragraph tags never appear. I also do not see wpautop() called anywhere in my theme (which I inherited from a now departed developer).

What can I do to set this straight? Adding <p> tags to everything is obviously not going to fly with the content editors.


Paragraph tags are added upon display, not upon storage. The wpautop() function is added as a filter to the_content.

You won't ever see these added paragraph tags in either the visual or HTML editors.

| improve this answer | |
  • Seems a bit silly no? Paragraphs are, well, paragraphs: why not wrap them in the appropriate markup? – gravyface Jun 1 '12 at 18:46
  • You're welcome to write a patch to change the behavior, but I doubt it would get implemented. :) – Chip Bennett Jun 1 '12 at 18:49
  • I'll live with it. Where abouts would I go to re-enable this? I just grep'ed through the theme directory for wpautop with no results. – gravyface Jun 1 '12 at 18:54
  • Re-enable what, exactly? wpautop() is added as a filter to the_content, in wp-includes/default-filters.php. – Chip Bennett Jun 1 '12 at 19:14
  • 1
    Odd, it's there (add_filter( 'the_content', 'wpautop' );), but when I create a new page, type a paragraph, add a line break (and highlight the text and choose "paragraph" from the styles, it looks great in the visual editor but when I publish it, there's no paragraph tags wrapping it; this is why I've been adding them manually in the HTML tab. – gravyface Jun 1 '12 at 19:37

One solution is to install the TinyMCE Advanced plugin. In the plugin settings you have a option "Stop removing the <p> and <br /> tags when saving and show Them in the HTML editor".

| improve this answer | |

Make sure you are using the_content for calling the post content and not something like get_the_content. WordPress wpautop filter is applied on the_content.

| improve this answer | |
  • That no makes any difference in the visual editor. Read the question again. – cybmeta Nov 21 '14 at 10:54

I just struggled with this same issue and was about to loose my mind because I tried everything mentioned above and other ideas. It turned out that the client was using a Yootheme, and there is a tick box in the settings of that particular theme, which when clicked solved the issue immediately. Here's a link to the forum post: https://yootheme.com/support/question/4342

In other words, it could be a theme related issue.

| improve this answer | |

nl2br() can be used to add the line breaks again when using the filtered HTML again

| improve this answer | |

The wpautop() filter changes the content view but not changes the view mode on the content editor.

Example: <?php the_content(); ?> displays the content normally. If you add remove_filter('the_content', 'wpautop'); the content is displayed without p tags.

In both cases, the content editor is displayed in the same manner

| improve this answer | |
  • 4
    That’s what Chip said. What is the point of this answer? – fuxia Jan 4 '13 at 18:04
  • It was supposed to be a comment, a supplement to the explanation made ​​by Chip Bennett. – Rafael Marques Jan 24 '13 at 2:52
  • 1
    If it was supposed to be a "comment," it should be a comment... – Dan Jan 24 '13 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.