Get Youtube videos to work in Wordpress MU

September 13th, 2009

Wordpress MU

I was tipped off about Wordpress mu as an easy platform to create a social blogging site with ease. So far in my testing I have not come across many problems that cant be overcome by a bit of research. This is what this post is about really as I couldn’t find any posts on it, but did find a little hint of what to do in a comment and it worked so I thought I would shear with the world!

Getting Youtube videos to show

There are loads of blogs out there and sometimes you might want to share a cool Youtube video that you have found on your blog, but if you use Wordpress MU then it will ‘clean’ the code of your post and remove the video. This is annoying. This can be fixed easily.

Step 1 – get the file

To get this ‘hack’ to work you are going to have to edit one of the core files in Wordpress MU. The file that we are after is called ksep.php and is in the wp-includes folder in your Wordpress install folder. Once you have got it I would suggest coping the file so that if you f*ck something up you have the original code to use to keep your blogs working.

Code to add

Now that we have the file, open it in your favorite html editor.

You will see a big long list of arrays that looks like this:

exapmle of kses.php in Wordpress MU

these are all the allowed html tags for blog posts. What you are going to do is add the Youtube tags to the allowed list (this one) and then you will be able to post Youtube videos on your blog (there might be security implications in doing this so don’t blame me if you get a drive-by)

The Code

Add the following two arrays to your file, i recommend putting them in the right place in the code as all the others are in alphabetical order.

Look for a line that contains: if (!CUSTOM_TAGS) {

Then add the following to the function

‘embed’ => array (
’style’ => array (),
‘type’ => array (),
‘id’ => array (),
‘height’ => array (),
‘width’ => array (),
’src’ => array ()),

and this:

‘object’ => array (
‘height’ => array (),
‘width’ => array ()),
‘param’ => array (
‘name’ => array (),
‘value’ => array ()),
‘object’ => array(
‘width’ => array (),
‘height’ => array (),
‘movie’ => array (),
‘allowFullScreen’ => array (),
‘embed src’ => array(),
‘application/x-shockwave-flash’ => array()),

One last thing

Now save your file.

Once you have save the file uploaded it to your server so it replaces the old one.

If you log into your admin panel and make a new post you should be able to add a Youtube video to your post no problem anymore.

I hope you found this useful, please comment if you did or found any mistake. Have fun, i’m off to have a good MU. DA

Tags: , , , ,

9 Responses to “Get Youtube videos to work in Wordpress MU”

  1. DennisVega says:

    I don’t usually reply to posts but I will in this case, great info…I will add a backlink and bookmark your site. Keep up the good work!

  2. Tnelson says:

    Hey very nice blog!!….I’m an instant fan, I have bookmarked you and I’ll be checking back on a regular….See ya

  3. JimmyBean says:

    I don’t know If I said it already but …Excellent site, keep up the good work. I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks, :)

    A definite great read..Jim Bean

  4. Kelli Garner says:

    Really nice posts. I will be checking back here regularly.

  5. gepeChequeVed says:

    Intresting, this was actually a very great read! thanks

    Watch Movies Online Now
    (DA edit – good attempt at spam but I don’t fall for it that easy! ;p)

  6. Sanjeev says:

    Thanks a lot buddy, the trci properly worked on my blog. Now I am able to add youtube videos on posts. Thanks for the help.

  7. loan says:

    cool nice site

  8. canada online pharmacies says:

    Great work, webmaster, nice
    [DA - More spam but I like it]

  9. telemarketing merchant says:

    need to improve your writing skills man
    [DA - You need to improve your spamming skills]

Leave a Reply