The WordPress editor is a great tool for writing visually appealing posts. For the most part, it shows you pretty much what the end result is going to look like when it's finally published, barring things like custom CSS etc, which will only show up in the final webpage. However despite its versatility, the developers have had to make some trade offs in its default functionality to satisfy the demands of the maximum number of people. One of those trade offs is the automatic insertion of paragraphs.
Pressing the "enter" key will create a new paragraph instead of a new line - leading to double spacing. Here's what it looks like:
This is opposed to the behavior or regular text editors like Notepad. However, for most people this works just fine. After all, how often do you really need to enter a newline and not a paragraph? There are instances though when you want just a straight new line. Like when writing addresses, poems, or any other content where presentation matters.
In this article, I'll show you three different ways to enter new lines in the WordPress editor - each suited to a different use case scenario. Namely:
- The occasional new line;
- Content that requires regular new lines often;
- Content where you need access to the visual editor and also need new lines.
Method 1: Using "Shift+Enter" for a new Line
As shown above, merely pressing enter inserts a new paragraph. However, pressing "Shift+Enter" creates a newline instead with a single spacing as shown here:
So any time you want to occasionally insert a newline into the visual editor, just press shift+enter and you're done! This solution is perfect for the infrequent newline when you're content to have the default behavior remain a paragraph when you press "Enter".
But what if your content requires newlines all the time?
Method 2: Newlines in the Text Editor for Long form Content
Let's say you're writing something like a poem that has dozens of newlines separated by occasional paragraphs. Pressing "Shift+Enter" each time can become annoying - especially if you're not composing the poem as such, but merely copying it from elsewhere.
In that case, I find it easier to simply switch the visual editor to the "Text" editor by clicking the tab at the top right of the text area. This switches the mode to basic text, without any of the fancy editing. It now functions pretty much like Notepad. So when you press the enter key while inside text mode, WordPress inserts a regular newline as shown here:
To enter paragraphs while in text mode, simply press the enter key twice! This way, you can write long form content like poems, scripts, without interrupting your flow as if you're using a regular text editor.
Method 3: Using "pre" tags in Visual Editor Mode
In certain situations, you want some content to stand out from the rest - like if you're writing a short poem in the midst of a longer article. You don't really want to go to "Text" mode because you want to retain the visual editor, and you also want your highlighted content to "stand out".
This is what the "pre" tag is for. "Pre" stands for preformatted, and anything you enter within those tags is rendered exactly as entered. You can select the "pre" tag from the drop down box on the top left of the visual editor as shown here:
So you use the <pre> tag for any content that requires to be displayed "as is", including specific form content like scripts, quotations etc.
These three methods of inserting single space lines instead of paragraphs in WordPress should cover any specific needs you have!