How can I improve the line break handling in the WYSIWYG editor?

What happens is that TinyMCE converts every double line break in the HTML source to <p></p> and vice versa. It will actually strip away any <p/> you manually enter in the HTML source after you save, because when the post’s content is rendered, <p> and </p> will be added.

The auto-<p> replacement only works when you’re rendering a post’s content with <?php the_content() ?>, if you output $post->post_content directly, it won’t go through the same formatting hooks and will look plain and without line breaks or paragraphs.

If what you want is lots of <br/> tags in the rendered markup, you should probably find a better solution based on CSS and the use of the margin or padding CSS properties.

Leave a Comment

tech