Is there a way to prevent WP from removing br and p tags from posts or pages ?
so far I've added remove_filter('the_content', 'wpautop');
to my functions.php
file which completely disables formatting.
However when i edit a post or page, and in the HTML editor add br or p tags then switch back to visual mod the br/p tags that i added get removed.
Is there a way to prevent this ?
It is not really a solution but a workaround: write your <p>
tags like this:
<p dir="ltr">something</p>
This way they are preserved when switching from editors. You can apply this to any text tag. Here you can read about the dir
attribute: http://www.w3.org/TR/html401/struct/dirlang.html
I have noticed that if you try to do the same with <br>
tags, when you swicht editors WP has replaced <br>
with a
. To prevent that, br
tags can be written like this:
<br class="blank" />
I am also looking for a definitive solution for this issue and it seems there is none yet, not even with the new Wordpress 3.6 release. Please if anyone knows a better solution I'll be so glad!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With