I have a plug-in that embeds some javascript. I've tried using remove_filter() to stop wpautop in every way recommend and still can't get wordpress to stop wrapping my <script></script> tags with with <p> tags like this <p><script></script></p>

I tried adding the following to both the short code php and also in the functions.php

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt',     'wpautop' );
  • 2
    Please provide the code that you have already tried. Feb 16, 2013 at 21:20
  • just modified the question with the code Feb 16, 2013 at 21:35

1 Answer 1


Here is one idea


function remove_stuff($content){
    return $content;
  • excellent idea, but it didn't have any impact. On further examination it appears WP is just adding a <p> tag before <script> and no closing </p>. At any rate, this code didn't stop it. The only way I've been able to totally prevent it is by tweaking wp itself and changing wpautop to just return without making changes Feb 17, 2013 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.