WordPress and the Mystery of the Disappearing Line Breaks

Nov 30, 2009

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.

Posted by razumny | Categories: Wordpress | Tagged: , , , |

Share with others

4 Responses so far | Have Your Say!

  1. Sebastian Steinmann
    November 30th, 2009 at 8:34 am #

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

  2. razumny
    November 30th, 2009 at 9:13 am #

    @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
    January 1st, 2010 at 4:40 pm #

    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.

  4. razumny
    January 2nd, 2010 at 7:44 pm #

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

All comments are moderated. I usually publish a comment within twelve hours of its posting. Other than that, I have a few simple rules; feel free to disagree with me, but stay on topic, and behave yourself. Comments containing insults, libel etc. will not be published. Your right to free speech does not mean I must publish what you write.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>