Last week, I learned the hard way that WordPress Multisite secretly strips out embedded videos and other HTML objects. With a single WordPress instance, you can easily import WordPress eXtended RSS files containing YouTube videos, iframes, etc. Then, when creating or editing a post, it’s simple to drop embed code in the body text, hit publish, and move on with your life. In WordPress Multisite, much of this HTML is stripped out by default.
If you aren’t migrating content into your new WordPress Multisite instance, a common fix to this problem is a plugin called Unfiltered MU. Unfortunately, it wasn’t a solution for me. It doesn’t work reliably, takes a roundabout approach to the problem by temporarily adding user permissions, and limits the fix to administrators and editors.
Because the J-School network is a controlled environment, I’m fine with giving authors and contributors the ability to embed videos. I put together a quick plugin called Unfiltered HTML which disables the kses filters when activated and declared mission accomplished.
Whoops, not entirely. Thanks to Andrew Nacin, last night I discovered that there’s actually a hard-coded call to the kses filter when importing into Multisite. This means all of your glorious embedded videos will be stripped out unless you comment out that line. Andrew committed a fix, though, which adds a method for disabling the filter.
Today’s project? Going through all of the content I imported into a couple dozen sites and manually adding the missing embeds by hand.
7 Comments
We are a custom website/web-application development company and we launched a multi-site wordpress powered website for one of our clients. They wanted pretty robust user privilege controls in using wordpress as a cms. Needless to say, they were having issue after issue when page authors editors would attempt to embed videos/iframes etc… and I spent countless hours trying to figure what was causing the filter, I just stumbled today on the fact that multisite does not allow you to enable unfiltered html for anyone but administrators. Further searching and digging led me to your page and what a burden that has been lifted! Thank you so much! This (at least in development site testing) appears to be exactly what I needed… I’m not afraid to hack WP core files, but i couldn’t find decent documentation on where the filtering was being applied… you have really helped us, thank you!
Wonderful! Glad it helped
Dude!!
I’ve looked everywhere for this and could never find an acceptable solution.
You’re the man!!
Thanks,
Phil
Awesome plugin! Thanks, man! For those that would rather not (or cannot) use a plugin, you can accomplish essentially the same thing without a plugin and without editing the core by simply calling kses_remove_filters().
More info here: http://endorkins.com/2013/08/27/disable-wordpress-kses-to-prevent-html-filtering/