How do I stop the editor from stripping my <p> tags and “empty (& nbsp;)” divs on pages?

Since @scribu asked for a sample code here it is:

Input:

<p>text</p>
<div>&nbsp;</div>

Output:

text

7 s
7

I had problems with TinyMCE Advanced. I struggled with this for a while. Finally discovered a simple solution – Use Shortcodes!

Place this code into functions.php and enter [br] wherever you want a br tag to appear.

add_shortcode("br", "br_tag");

function br_tag(){
        return("<br/>");                            
}

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *