WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] YouTube embed and iframe both not working (4 posts)

  1. beyoutifully
    Member
    Posted 1 year ago #

    I can't get YouTube embed or iframe to work. (Yes, they're in HTML and not the visual editor.)

    When I preview the post, it just gives me a large blank space where the video should be. When I view it in the visual post editor, I get a large yellow box - what looks like a tiny browser window in the center of it for iframe, and what looks like a tiny Flash logo in the center of it for the old embed code.

    Here's an example of how the embed code looks when I paste it:

    <object width="640" height="480"><param name="movie" value="http://www.youtube.com/v/kJ1OdKdvg4g?version=3&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/kJ1OdKdvg4g?version=3&hl=en_US" type="application/x-shockwave-flash" width="640" height="480" allowscriptaccess="always" allowfullscreen="true"></embed></object>

    And what it changes to when I go back to it (even just clicking to the visual tab and clicking back to HTML):

    <object width="640" height="480" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/kJ1OdKdvg4g?version=3&hl=en_US" /><param name="allowfullscreen" value="true" /><embed width="640" height="480" type="application/x-shockwave-flash" src="http://www.youtube.com/v/kJ1OdKdvg4g?version=3&hl=en_US" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object>

    What the iframe code looks like when I paste it:

    <iframe width="640" height="480" src="http://www.youtube.com/embed/kJ1OdKdvg4g" frameborder="0" allowfullscreen></iframe>

    And what it changes to when I go back to it:

    <iframe src="http://www.youtube.com/embed/kJ1OdKdvg4g" height="480" width="640" allowfullscreen="" frameborder="0"></iframe>

    Not sure what other info to add. Thanks in advance!

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Don't switch between the visual and text editors - it will corrupt your code. You also don't need to use anything except the URL for the YouTube video - see:

    http://codex.wordpress.org/Embeds

  3. beyoutifully
    Member
    Posted 1 year ago #

    That worked! Thanks! I didn't know I could embed it that way.

    Even when I didn't switch back and forth between visual and HTML - just input the code into HTML and hit preview - it wouldn't work. Is that normal too?

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    I would not think so, but preview might be problematic. And it seems like YouTube video code can be cranky sometimes...so maybe that was the case here. But now you have the truly easy way working :)!

Topic Closed

This topic has been closed to new replies.

About this Topic