Note: Titles are similar but this is a different issue than Square brackets make WordPress ignore newline/paragraph
I'm using the classic editor in the latest version of WordPress. To have the visual editor generate a line break (<br>
) instead of a new paragraph (<p>
) I use Shift+Enter. The visual editor shows this:
line 1 line 2
If I just use Enter, I get this (indicating a new paragraph tag):
line 1 line 2
The problem occurs when line 1 ends with a square bracket, like so:
line 1 [C] line 2
it looks okay in the visual editor but the browser renders it as a single line:
line 1 [C] line 2
Looking at the HTML source, the first example inserts a <br />
for the newline while the second example inserts an actual newline \n
(which is just generic whitespace in HTML and doesn't start a new line).
Can anyone explain why this is happening and how to fix it?