How to automatically add paragraph tags in the Visual Editor

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.

Related posts

Leave a Reply

6 comments

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

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

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

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