0

Why does the text editor remove paragraphs and line breaks?

Surely maintaining basic formatting such as paragraphs or line breaks is a basic requirement in all CMS systems. It's hard to believe that WordPress has remained the most popular content management system on the market when it's not even able to maintain basic text formatting.

I've searched numerous forums - all of which recommend the TinyMCE Advanced plugin or manipulating the wpautop() function - but nowhere is there a clear explanation of:

  1. why Wordpress removes paragraphs and line breaks in the first place;

  2. what is best practice for stopping the text editor from behaving this way.

  • 1
    The simple answer is: Because average users will not know to use <p> and <br> tags when typing in the Text view (note it's not HTML view). When they add a line break in the editor, they expect a line break on the front end. As such it needs to dynamically add and remove them, and this is an imperfect process. You might want to say "the Text view should just be for developers!" or something like that, but clearly that's not how people are using it, and it has not stopped (and arguably helped) WordPress becoming the most popular CMS, as you say. – Jacob Peattie Mar 7 '18 at 13:01
  • That said, I've not had any issue with WordPress 'maintaining' line paragraphs and line breaks. What issues are you having exactly? – Jacob Peattie Mar 7 '18 at 13:02
  • Interesting. Could this be a Visual Composer problem...? – Richard Tinkler Mar 8 '18 at 9:59
  • Can't say. You haven't actually specified the problem. But if it were you'd find out by disabling it and seeing if the issue still occurs. – Jacob Peattie Mar 8 '18 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.