FindsGood

insert line break <br/> HTML tag in get_the_content(”) of WordPress

Learn how to insert line break HTML tag in get_the_content('') wordpress

nl2br(get_the_content(''))

PHP nl2br() Function inserts line breaks where newlines (\n) occur in the string.

The browser output of the code above will be:

One line.
Another line.

The HTML output of the code above will be (View Source):

One line.<br />
Another line.

we use this get_the_content(”) in a loop, tag and category template. not in a single page template. So, nl2br() its automatically inserts line break HTML tag in WordPress content.

Comment

WordPress Tips and Tricks