Retain Line Breaks

How to retain line breaks and single spaces in WordPress text content

Here’s a trick to maintain the single spacing when pasting from a Word doc. In Word we call it single spacing in HTML we call it line breaks. Either way all we want to do is keep the tight spacing.

WARNING: Word is meant for print media and depending on how you have your content formatted using this method can break your post and add a bunch of Word formatting that can not be read by browsers. Use with caution!

I have tried the “Paste as Plain Text” and “Paste from Word” both add an extra line between lines. I have tried checking the box to retain line breaks with the “Paste as Plain” text command – still an extra line. Pasting directly into the Visual Editor doesn’t work either. This is what I get with all 3 methods:

Retain line breaks in WordPress editor
Pasted directly into the Visual Editor

What I could do to get rid of the extra line is to place my cursor at the end of each line and hit delete on my keyboard. This will bring the line below up in line with the one above, then use shift + enter to take it down for single spacing. If you have a large document this is a laborious task.

This is the only way that I have found to keep my spacing. It is quick and easy.

  1. Click on the HTML tab of the editor
  2. Paste your text that you copied from your Word doc.
  3. Switch back to Visual and apply your formating.
Retain line breaks in WordPress editor
Retain line breaks in WordPress editor

Related tip:
When you are typing in the editor and want that same single space (a.k.a. line break) use “shift + enter” on your keyboard
That’s what I did to type this tip.