Programming / Technology / WordPress · 2012-02-12

WordPress Not Creating Line Breaks

This still works but the UPDATE below is better

The solution to WordPress not recognizing line breaks is to tweak your source code.  You will need a way to edit the HTML on your site.  Go to wp-includes -> post-template.php

Search for “function the_content“.

At the end of that function you will see:

//
echo $content;
//

Change that to:

//
echo nl2br($content);
//

That will convert your line breaks in the code into a line break in the HTML code.

UPDATE

Thanks to the WordPress forum, I have found another (possibly more proper) fix to this issue.

In your WordPress plugins, search for a new plug-in called “TinyMCE-Advanced”, or download it from here: http://wordpress.org/extend/plugins/tinymce-advanced/

Next, go to your TinyMCE-Advanced settings and select the checkbox that says “stop removing the <p> and <br> tags”.