2
votes

In Wordpress editor (TinyMCE), whenever I switch between 'Visual' and 'Text' mode, all my HTML formatting gets removed. That includes tabs (indents) and line breaks. Sometimes, even elements and elements attributes are removed.

I searched a lot about this issue, wich is actually a pretty common problem for many users, but after browsing 10 pages of Google, I got nothing but a plugin called Preserved HTML Editor Markup Plus. The problem is this plugin conflicts with Yoast SEO plugin.

Is there any thing I can do to preserve the HTML formatting, allowing both modes (Visual and Text) and not knowingly compromising other plugins?

2

2 Answers

1
votes

You should try TinyMCE Advanced Plugin.

TinyMCE Advanced have set to Stop removing the <p> and <br /> tags when saving and show them in the HTML editor.

Try it after removing another editor plugin which you have installed to prevent conflict with other.

The second option is Raw HTML plugin. It has also a good feature to prevent HTML formatting. You can use [raw] shortcode like [raw] YOUR HTML [/raw] to prevent HTML formating.

You can try this both plugin once. Hope one of from these option work for you.

Thanks.

0
votes

Wordperss has wp_kses function that only allow certain html tag in post content.

If you want to certain html tag / attributes allowed in your post content , you need to remove kses filter ( kses_remove_filter ) functions added in your theme / plugin.

Reference

https://codex.wordpress.org/Function_Reference/wp_kses

https://developer.wordpress.org/reference/functions/kses_remove_filters/