Line Breaks are stripped off when direction property is found

The line breaks are stripped off when the p tag has a dir attribute inserted, to explain further I'll list some examples.

Let's say we have 2 lines of text as following

pText Paragraph Number One Goes Here/p
pText Paragraph Number Two Goes Here/p

If I want to add line breaks between the two paragraphs it works fine to become like:

pText Paragraph Number One Goes Here/p
pnbsp;/p
pnbsp;/p
pnbsp;/p
pnbsp;/p
pnbsp;/p
pText Paragraph Number Two Goes Here/p

However if the paragraphs have a dir attribute as below

p dir=ltrText Paragraph Number One Goes Here/p
p dir=ltrText Paragraph Number Two Goes Here/p

All p dir=ltrnbsp;/p are removed and no line breaks are inserted.

The site has TinyMCE plugin which has an option to keep paragraph tags in the Classic block and the Classic Editor but this didn't solve the problem. I disabled the plugin and also didn't resolve the issue.

And also I added the wpautop hook in functions

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

This also didn't resolve the issue.

The line breaks works perfectly if p tags have no direction attribute while when it has the dir attribute like this p dir=ltrnbsp;/p they are removed.

Any line break after it gets stripped off especially if it's a non-latin language.

Topic line-breaks plugin-tinymce wp-autop plugin-wpml filters Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.