WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|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
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".

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

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

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

share|improve this answer
That’s what Chip said. What is the point of this answer? – toscho 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
If it was supposed to be a "comment," it should be a comment... – Dan Jan 24 '13 at 3:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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