Get WordPress MU To Stop Worrying And Love Embedded Stuff

Kaplak Stream is based on a WordPress MU install (currently v2.6.1), where a network of niche sites are fed one or more feeds on a particular subject in the ‘stream’ or from particular online services, using feed aggregation tools.

Building the setup for Kaplak Stream so far has revealed a path ridden with challenges (as one might expect). WordPress MU, which is a tremendously powerful package, is not as widely used as it’s popular little sister, and therefore is less well documented and supported, which goes too for the compatibility and effects of various plugins.

One initial thing which gave rise to some trouble, was to get WordPress MU to stop worrying and love embedded stuff such as YouTube videos and widgets. WordPress MU was designed for great environments hosting thousands of blogs, with thousands of different users, and has a higher security threshold than regular WP. And there’s no way to turn this filtering of tags off in the Admin interface.

Now, there’s a plugin called Unfiltered MU which will remove this filtering of posts and thus allow the embedding stuff. Unfortunately this plugin works only with posts actually published using the Admin interface editor. It doesn’t work with imported posts (from your old single-WordPress setup), and apparently it doesn’t work with aggregated posts either. So if you setup MU and want it to import an old blog or set it up to aggregate items from a feed, you still got trouble.

I found out one has to manually edit kses.php to enable the tags used by embedded stuff, at one’s own peril. For our purpose, however, we’re not concerned with security in the sense that we are the only users of our system, for the time being.

At your own peril (I underscore the fact that you may put your setup at risk enabling these HTML tags, but hey, life is dangerous) : Put in these tags and something along the lines of the below code into your “allowed” arrays in kses.php : object, embed, param, script.

'object' => array (
			'id' => array (),
			'classid' => array (),
			'data' => array (),
			'type' => array (),
			'width' => array (),
			'height' => array (),
			'allowfullscreen' => array ()),
'param' => array (
			'name' => array (),
			'value' => array ()),
'embed' => array (
			'id' => array (),
			'style' => array (),
			'src' => array (),
			'type' => array (),
			'height' => array (),
			'width' => array (),
			'quality' => array (),
			'name' => array (),
			'flashvars' => array (),
			'allowscriptaccess' => array (),
			'allowfullscreen' => array ()),
'script' => array (
			'type' => array ()),

Pick the ones which you need for your videos or other embedded media to work. Allowing the ones listed will allow video embeds from most providers, incl. YouTube, Google Video, Viddler, Blip.tv and others as well as widgets from a lot of sources. It works on posts aggregated by FeedWordPress for instance, which was my problem with the “Unfiltered MU” plugin.

Tags : , , , , , , , ,  

Timeline


4 comments ↓

#1 Quincy on 11.10.08 at 21:19

You are the bomb. Thank you for posting this. I was looking for the solution all day.

#2 Morten Blaabjerg on 11.10.08 at 21:57

You’re welcome – glad to be of help :-)

#3 yair on 01.28.09 at 02:14

helo
i whant to enable a embed code in mu
were do i need to put this code in kses.php?

thanks

#4 Morten Blaabjerg on 01.28.09 at 14:28

@yair
You need to enable the relevant HTML tags (i.e. “embed” and possibly others) in kses.php. Take a look at the file, and I’m sure you’ll find the list of HTML tags which are exemted from the filtering done by WPMU.

Take care and know what you do, or be prepared to be at risk, because you’re exposing your site to new risks by taking these tags out of the filtering equation. By far I’d prefer another and safer solution but have not yet found any plugins to do this, which are service-independent.

Leave a Comment

Additional comments powered by BackType