There’s nothing more frustrating than embedding flash players into a post and then WordPress adds html that screws up the embed code. One workaround I found was to remove the filter that adds paragraph tags automatically in posts by adding the following line just before the_content() tag in the single.php template file:
<?php remove_filter ('the_content', 'wpautop'); ?>
You could also apply this removal sitewide by modifying your wp-includes/default-filters.php file and commenting out the wpautop function. Flash is now happy.
Additional resources:
http://codex.wordpress.org/Plugin_API#Removing_Actions_and_Filters
http://wordpress.org/support/topic/206698?replies=9
This entry was written by , posted on March 1, 2009 at 3:58 pm, filed under Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
Yes!! This is so awesome. Works like a charm. Screwy paragraph tags were making me crazy. Thankyou!
funny how you forget things and have to go find them again. one day i’m gonna write all this on my own blog – till then, thanks for the post, ross!
@ Anne & Firestorm: you're welcome!!!
Ross, is this still working? I've tried implementing it by both methods and I am not having any luck whatsoever. I am using 2.8.3. Thank you.
Hey Richard. I haven’t tried it in a while, since 2.8. So can’t promise anymore.
i was stuck for 3 hours couse of P tag… but just added this 1 line, it works well now!! thank you, thank you, thank you…
ohhh thank you thank you thank-you… my current project was getting screwed because of this one problem and your posts just helped me fix it. Thanks a ton
Sure thing @TechSlam. Happy WordPressin!
I tried this and for some reason all the page content was doubled. I was able to use just the first line and it solved my original problem though.
thanks
Brilliant! Thanks for sharing this tip!
@ben yeah a bit unclear on my part, just add the first line. or else you've got the_content template tag doubled. glad you figure it out!
Works perfectly for me in 2.9.2. Thanks a lot!
Thanks a lot for this trick. This helped me for meta.
This worked perfectly, thanks so much! (WP 2.9.2)
Thanks man. Very helpful. I really like your blog design too; simple, straight-forward, leathery.
This has been driving me crazy for days, managed to remove my
tags by commenting out the wpautop function, thanks for the info, you're a star!
Hi
I am a complete novice when it comes to editing code in the php files…I have managed to avoid it all costs! However, I have been searching for a solution to the problem in WordPress (stripping them out no matter how I add them). All I want is a hard break in my content!! Anyway, could you show me EXACTLY where the code string below gets inserted into the single.php file??
thanks very much
@elaine “just before < ?php the_content() ?> tag” as I explain above. :-)
Legend!
My initial problem was that the tag made it impossible to align images correct without using -XXpx; in margins. This thing helped a bit and I thank you. A pity though that this disables my clients ability to use the visual editor with it’s original simplicity, as I don’t want them to screw things up with ‘s. You should never underestimate simplicity!
But for clients who do not rely on this kind of simplicity, your fix is cool! Thanks!