Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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' );
share|improve this question
2  
Please provide the code that you have already tried. –  Joseph Feb 16 '13 at 21:20
    
just modified the question with the code –  John Carter Feb 16 '13 at 21:35
add comment

1 Answer 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;
}
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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