Support » Fixing WordPress » Embedded YouTube videos removed by visual editor

  • I seem to remember in 3.04, managing without difficulty to embed a video into a page using the visual editor. Now, all this will add is a link to the video on YouTube. If I want to add it I have to use the HTML editor and YouTube’s provided “embed” code. The more annoying bit, though, is that if I then try to make any change at all in the visual editor, the video is removed.

    Adding a video isn’t a problem for me, as such. The problem is that I want to get other (non-HTML literate) people to maintain most of the content on the site. As it stands, I will have to step in to make any changes to pages and posts containing videos.

    Is it an intended feature, or a bug? I would be interested in knowing whether anyone has found any solutions.


    This is the page in question:

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m not sure why the embed code doesn’t work but WordPress has oEmbed built-in, which means on popular video sites like Youtube all you have to do is drop the URL to the video into the post editor and it will automatically turn it into the embed code. Personally I think this is easier for a non-HTML literate person to do than dropping the actual embed code into the editor.

    I didn’t think putting an embed code in the visual editor worked before 3.1 🙂 Before oEmbed I always switched to HTML mode, or used a shortcode.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Yes, to embed a video, just do this:


    That’s been built in since WP 2.9. And on the Settings->Media page, you’ll find an option called “When possible, embed the media content from a URL directly onto the page. For example: links to Flickr and YouTube.”

    Turning that option on will allow you to embed videos and other content just by putting the youtube link on a line all by itself, no embed tags needed.

    Thanks for the replies. Neither of those methods are working for me, though.

    The embed tags just give a link, as does the “add video” dialogue box, while dropping the link into the visual editor just displays the text of the link. I do have the “Where possible embed…” option ticked on the settings page. When I have time, I’ll try a few other YouTube links, and see if they’ll embed properly.

    I had wondered whether the code was being removed because it was failing validation. However, I’ve made a slight modification to YouTube’s code, and it now passes the W3C validator, but I have only to view the page in the visual editor for it to disappear, when I update or switch back to the HTML editor.

    When using a link to a Youtube video (or any of the oEmbed supported sites) make sure you just include a text link – it should not be hyperlinked. If you switch to HTML view, you should still just see, not <a href=”…

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    The embed tags just give a link, as does the “add video” dialogue box, while dropping the link into the visual editor just displays the text of the link.

    Right, that’s how it’s SUPPOSED to work 🙂 I promise, you toss that in and it works. WordPress has (since 2.9) handled that for you. They’re trying to make it easier.

    Same with QuickTime movies. There is no way I found to easily embed QT. You end up with a link that opens in a new window, even for local (media gallery) files.

    The dedicated embedded video button has been removed from 3.1. Someone found a release note somewhere that says that development of this feature has not been completed for 3.1.

    I reverted back to 3.0.5.

    Okay, I have now got it to work, sort of. I realised I needed to use the URL of the YouTube page (…), rather than the embed URL (…).

    Now, when I view the post, at least I see a black rectangle where the vid should be (rather than just a hyperlink), and if I right-click on it, I get the typical pop-up menu for a flash video. It doesn’t display any controls or play, though. I am using the free Gnash plugin at the moment (haven’t checked yet with Adobe’s plugin).

    I checked out the page source, and it is embedded with the old-style code that YouTube used to supply (using “object”, “param” and “embed” tags), rather than the newer-style way using an iframe. Obviously, this is due to the code YouTube chose to send back.

    The test post is here. It contains the same video, embedded twice – the top version was added just by dropping in the URL on a line by itself, the second as an iframe.

    I’m sure there’s a better way of doing this. Might start a little hacking when I have time.

    Thanks for the tips on embedding youtube videos.

    I was wondering if i can make some of the videos auto play when the page loads.. I was adding &autoplay=1 to the end of the url when i embedded the video in html… how do i embed it this way in the visual editor and get it to auto play?

    And is there anyway to individually adjust the size of each video?
    I see that you can go to media settings and adjust size but thats going to change it for all the videos i think?

    I like to use my own embed codes because I like to disabled related videos and select a custom video frame size, so that it fits flush with the width content area.

    I would love it if there was a way to keep WP editor from removing my embed codes, at the moment I’m keeping them embed codes in a text file so I can slip them in during the final stages of editing directly into the code editor.

    WordPress removes iframe when you switch from “HTML” to “Visual” tab in your editor because of the security reasons.

    1. You may paste Youtube or Vimeo link into post but sometimes it does not convert into video corectly.
    2. You may use WordPress default shortcode: [embed width="500" height="400"][/embed].
    3. If you simply want to embed iframe into post you can install iframe plugin and paste this shortcode into content: [iframe width="640" height="480" src=""]

    More info about embeding iframe into post content.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Embedded YouTube videos removed by visual editor’ is closed to new replies.