0

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
  • 2
    Please provide the code that you have already tried. – Joseph Leedy Feb 16 '13 at 21:20
  • just modified the question with the code – John Carter Feb 16 '13 at 21:35
1

Here is one idea

add_filter('the_content','remove_stuff',99,1);

function remove_stuff($content){
    $from=array("<p><script>","</script></p>");
    $to=array("<script>","</script>");
    $content=str_replace($from,$to,$content);
    return $content;
}
1
  • 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 – John Carter Feb 17 '13 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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