3

So I have a problem when making a post. If I press enter and make a new line in the editor and press safe the line break diapers. But when I show the post it have inserted a line break. So somehow the editor is not able to show the line break? If I save the editor again the line break disappears from the post as well.

Any ideas?

I read in a post to try and use:

remove_filter ('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

Which I did and now line breaks don't work at all. I have build a custom page where the posts are shown with the

echo the_content();

2 Answers 2

0

You've stumbled across a 'hidden' feature of WordPress and TinyMCE (the visual editor) it has a problem with line breaks and strips them out.

Try either of these two plugins: http://wordpress.org/extend/plugins/line-break-shortcode/ http://wordpress.org/extend/plugins/simple-breaks/

8
  • There is no way to handle this in any other way? Like editing the code for the editor and put like a nl2br() around the content? Jul 15, 2012 at 21:43
  • 1
    there are comments on WordPress.org about this - but it's not a good idea to hack the core code of WordPress. You could break your WP install & your hack would be deleted next time you try to update to a new version.
    – Damien
    Jul 15, 2012 at 21:49
  • That is so true Damien... I am just very frustrated about this simple issue :) Jul 15, 2012 at 21:57
  • It's actually a 'good' feature which prevents users from adding unsafe HTML code via Tiny MCE and its from an assumption that people pressing Enter key want a paragraph break.
    – Damien
    Jul 15, 2012 at 22:02
  • did you try this ... codex.wordpress.org/Function_Reference/wpautop
    – Damien
    Jul 15, 2012 at 22:03
0

Ah sorry I just realized that I had margin: 0 on all elements to reset all defaults in browsers... this caused the issue!

Not the answer you're looking for? Browse other questions tagged or ask your own question.