I am using WordPress editor TinyMCE. I have something like this:
<div class="TA_excellent" id="TA_excellent150"><ul>...</ul></div>
<script type="text/javascript" src="http://www.jscache.com/wejs?wtype=excellent&uniq=150&locationId=287500&lang=en_AU">
</script>
When I skipped to visual editor “script” tags are removed from the content. So I tried every kind plugin including Ultimate TinyMCE but this time “script” tags are wrapped by “p” tags.
So output is something like this:
...</ul></div>
<p>
<script type="text/javascript" src="http://www.jscache.com/wejs?wtype=excellent&uniq=150&locationId=287500&lang=en_AU">
</script>
<script src="http://www.tripadvisor.com.au/WidgetEmbed-excellent?uniq=150&locationId=287500&lang=en_AU"></script
</p>
I also tried plugin called “Advanced TinyMCE Settings” it allows me to change the default TinyMCE configuration. My config under TinyMCE settings is like this:
extended_valid_elements: script[type|src],a[*]
I spent hours and hours on it just won’t work. I can’t get rid of this “p” tags. They keep continue to publish automatically.
Here are screenshots from Ultimate TinyMCE:
Removing unwanted p and br tags (empty ) can be done by adding simple filter function to theme functions.php
Here is the code you need to add.
Use this code to remove
<p></p>
before editor initialize.It can be done without code.
Go to
Settings
>TINYMCE Advanced
and checkStop removing the
<p>
and<br />
tags when saving and show them in the HTML editorWhereas it is bad practice to put scripts in your text area, well you can remove
<p>
tags by doing this: