Skip to content

WordPress and the Mystery of the Disappearing Line Breaks

This article was been published more than a year ago. The information may be outdated.

I’ve been running my blog on Wordpres for over a month now, and I am mostly happy with what I’m seeing. It does most of what I want it to do natively. As for what it doesn’t do natively, there is usually a plugin to do that for you.
 
The only thing I’ve as yet been unable to make it do satisfactorily, is line breaks. TinyMCE, the text editor in WordPress, executes a back-end filtering process every time you switch from Visual to HTML and back, as well as whenever you save your posts. This filtering process, for some reason, filters out both <br>, <p> and </p>.
 
I originally tried to resolve this by installing a plugin called TinyMCE Advanced, which worked pretty nicely, except that, when I was typing up this post, it filtered so that my code examples above were converted so that they became actual HTML tags.
 
I then installed another plugin called TinyMCE Valid Elements, in which I defined <br> as a valid element. Sure enough, TinyMCE no longer filtered out the tag, but it wasn’t parsed either.
 
I will continue to try to fix the problem. In the meantime, I have a workaround. By adding &nbsp; wherever I want a break, I get my line breaks.
 
Note: Comments disabled due to massive amounts of comment spam

4 Comments

  1. Sebastian Steinmann Sebastian Steinmann

    I think you can use SHIFT+RETURN for a hard linebreak, othervise RETURN should result in a new P element.

  2. @Sebastian: I’ve tried them all, and they don’t help. plus. adding &nbsp; isn’t such a hassle, as long as you know that that is what you need to do…

  3. Mark Saleski Mark Saleski

    i have seen this too, but only when i’m using google chrome. it doesn’t happen with firefox.

    annoying because chrome is my main browser, but if i want to add something to my site i’ve got to switch back to firefox.

    • @Mark: That certainly is weird; the error should not be browser specific.

Comments are closed, but trackbacks and pingbacks are open.