How To Force Line Breaks In Wordpress Documents

computerkickTrying to add line breaks in a Wordpress document using traditional methods like hitting enter multiple times, adding <br> tags in the HTML editor, or even adding additional paragraphs using <p></p> tags does not work. I can only assume that you have realized that, because you’re here now looking for a solution – no one wants all of their content to be smooshed together against their will. The good news is that there is a way to force line breaks in Wordpress, and it’s so simple that it might make you chuckle.

Wordpress, a very ’smart’ platform, is so smart that sometimes it tries to think for you. So, when there is a lot of space in a Wordpress document with no content, it will automatically strip the content-less code to make things cleaner and to improve efficiency.
 

How sweet of Wordpress :-)
 

The problem is that human authors actually want that spacing when we deliberately put it there! So, like anyone else who is too smart for their own good, we simply have to trick Wordpress into giving us what we want by superficially satisfying it’s requirements.
 

In English, we’re going to fool Wordpress into thinking there is content where it really isn’t.
 

All you have to do to force line breaks in a Wordpress document is add a non-breaking space before the line break code (in the HTML editor, of course). Do this for every line break that you want, for as many as you want:


&nbsp;<br>
&nbsp;<br>
&nbsp;<br>

 

Wordpress thinks that there is content on those lines because technically there is, it’s just invisible content! It’s only a non-breaking space, but it’s enough to qualify as a line of content. If this tip helped you, please leave us a comment as a way of showing your support.
 

Thanks for reading, and happy blogging :-)

 

[NOTE] If you use the forced line breaks in your Wordpress document, you will have to edit that document in the HTML editor from then on or Wordpress will strip the line breaks. I know it stinks, but hey – Wordpress is just trying to be helpful, right? :-P

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Facebook
  • Digg
  • del.icio.us
  • StumbleUpon
  • Squidoo
  • LinkedIn
  • MySpace
  • Technorati

4 Responses to “How To Force Line Breaks In Wordpress Documents”

  • Mark says:

    Thanks for this – sorted me right out

  • Chris says:

    Nice. Except the next time someone clicks on the visual editor for WP, your line breaks are gone again.

    Yes, WP deliberately seeks out and deletes that “invisible content.” Why? It’s so infuriating.

  • admin says:

    Wordpress is just trying a wee bit too hard to be helpful :-P

    And you are definitely right about the fickleness of the forced line break – if you don’t continue to edit the document in the HTML editor, the visual editor will strip the line breaks, taking you back square one. I will add a note to the end of the original post to make new readers aware of that before they use the method.

    Thanks!

Leave a Reply



Tip Jar

If this blog has helped you enjoy your Wordpress experience, show your love!


Contact Us!