YouTube’s iframe embedding option causes problems with WordPress

Just a heads up. YouTube has switched their default embedding option from an object to an iframe.

YouTube iframe embed option causes problems for WordPress

If you snag the embed code from the video’s popup panel you’ll still get the the Object code. It’s only when you’re on YouTube’s site and click YouTube’s Embed button that you’ll get the iframe code.

The iframe option is supposed to improve compatibility with mobile devices. Unfortunately, if you paste that code into WordPress, WordPress will strip it out when the page renders and you won’t get any video. (Tested with WordPress 2.9.2 and 3.04.) You’ll need to check the box next to “Use old embed code” to get the object code:

The "old embed code" option uses an Object tag, which works fine with WordPress

WordPress Embed ButtonYou can also put the video’s YouTube URL on a line by itself and WordPress will automatically embed it. You can set some options by adding them to the URL. Instructions here. Or just use the Embed button (it looks like a green piece of film) which has a user interface for setting the size, autoplay, and other options.

This entry was posted in Social Media and tagged , . Bookmark the permalink.

 

 

3 Responses to YouTube’s iframe embedding option causes problems with WordPress

  1. Andrew says:

    I noticed this bug (?) quite a while ago when attempting to add another iframe code, unrelated to Youtube. However, it seems WordPress only strips it out when I switch from HTML to Visual mode in the editor. If I actually add it in the HTML mode and publish it without switching to visual, it shows up alright.

  2. dEVY says:

    love you :)