SOLVED – YouTube or Other Videos Not Embedding in WordPress MU Posts

If you are a WordPress MU administrator and getting complaint that your users are not able to upload or embed YouTube videos or any other video in posts then here is the solution to do that. In WordPress MU, when you will try to embed the code of YouTube video, it will disappear after hitting the ‘Publish’ button. To embed YouTube video or any other video, you will have to make some code changes in WordPress MU file.

In WordPress MU setup, under ‘wp-include’ folder, you can find ‘kses.php’ file. You will have to edit that file to enable YouTube or Other videos embed feature in WordPress MU posts. Open ‘kses.php’ file on editor and make the below changes into that file. First of all try to find the code (in black color) on kses.php file. These changes will enable your WordPress MU editor to embed videos like YouTube and Vimeo.

After the below piece of code;

 'ol' => array (
    'class' => array (),
    'start' => array (),
    'style' => array (),
    'type' => array ()),

Add the below mentioned code,

    'embed' => array (
    'style' => array (),
    'type' => array (),
    'id' => array (),
    'height' => array (),
    'width' => array (),
    'src' => array ()),
'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()),

Save the ‘kses.php’ file and upload it to your server. Now you can embed a video (for example YouTube) code and publish the post. Now your post will show the newly embedded video in proper way. You may add other type of media tags to add them in your posts on MU.

Related: Enable Theme and Plugin Editor on WordPress MU

Sanjeev Mishra is a professional blogger and an Internet Marketing Consultant based in India. He has built the Internet Techies to provide you updates in technology and web application area.
  • This is very useful post for me. Actually many time i tried to add video from youtube but could not. Here i got the perfect solution. Thanks buddy.

  • Why does WP MU not come out with that already done? Just asking as I know many don’t like editing WP files, to afraid to make the change and then they have to edo the change when a new version comes out.

  • This looks great, thanks–but I’m wondering what happens when it’s time to upgrade MU. Do we have to re-upload this file every time we upgrade?

  • anony

    Its dangerous coz this code allow XSS!

  • I’ve been looking at downloading videos from YouTube, it seems that YouTube and many other social network sites have changed their code in order to prevent certain sites from allowing you to download video content from them; most annoying, is there a foolproof alternative? Anyway, excellent blog post, I found it very insightful

  • Sorry, this is NOT recommened. Do not hack the core, when there are plugins to do this for you.

    Also, new in 2.9.1 video embeds are built in and enabled for MU.

  • No Way

    What is with WordPress anyway… I mean if this program is this vulnerable maybe it’s time to go elsewhere’s

    Anyway, I tried your fix and was able to embed a video but I believe it was an .rm flavor and I had no controls over the video (play etc)

    Then, I went and followed Andrea’s advice and downloaded some german guys plugin that did absolutely not a thing….

    Help Please!!!!

  • Sanjeev,

    Thanks for this. I do have WP MU 2.9.1 installed. I tried embedding viedos on my webpage . It still doesent show up on the post as embedded. It only shows up as a link . However one link showed up as embedded the others are not . I even tried what you recommed ed up here . Still it doesent seem to fix the issue. Can you suggest what could be the problem

    Regards

    Venu
    http://forexwecan.com/wordpress-MU/myblog/2010/01/20/video/

  • Youtube is my favortie site to visit aside from facebook. most of the time i watched movie trailers and music videos on it.

  • Hi Venugopal,

    You can send us the details of you site. or you can contact us thru Skype (clickonf5). We will look into your issue and will be happy to help you on that.

  • very helpful! thanks

  • Perk

    The code is not keeping a portion clean:
    <embed src="http://www.pbs.org/wgbh/pages/frontline/video/flv/generic.html?s=frol02p79&continuous=1

    The <embed src=" is being changed to: <embed src="

    I copy the entire file and saved it. Any Suggestions:

  • Perk

    Your site change the code back to the original.

    This is the code: close the space: & lt;embed src=& quot;

  • Vishal

    I have fixed the bug using above guidline in kses.php but still not able to display the flash embaded youtube video in wordpress forum posts even if it stores the thing as in the database
    “hello,

    Any idea how to solve this?I use BP-tinymce editor to post the forum posts.

  • Works fine on WordPress MU 2.9.2. You save me :). Thanks!

  • Thanks a lot Sanjeev.