Wordpress: Solving The YouTube Problem

By Imar at Blogsolid

I was quite surprised when I recently tried to embed a YouTube video in a post on my Wordpress blog and it did not work properly. Upon researching the matter I found that it is a known issue. Wordpress does not like strange things embedded in posts and unfortunately, YouTube is one of those things!

A number of video-related plugins are listed on the Wordpress Plugin database. Many of these plugins have multiple features, but I was just looking for the simplest solution to embed a YouTube video in my post…

I found Paul Bain’s “EasyTube” solved my problem quite effectively.

  1. Download the .zip file from the link above, extract the contents and copy the .php file to your Wordpress plugins folder (located in your blog’s root-folder > wp-content > plugins).
  2. Log into your WP-admin and activate EasyTube from the Plugins control panel.
  3. To embed a video in your post, write “youtube:” followed by the URL of the video. Enclose this line in square brackets and you’re done. It should look something like this:[youtube:http://www.youtube.com/watch?v=XxXxxxxXxxX&eurl=]
  4. Remember to use the URL of the video, not the embed code!

You can write this code in either the visual or code editor of your Wordpress blog and the result is a valid page containing your video.

If you know of any other solutions to this problem, please post a comment!

Bookmark this article on del.icio.us | Bookmark this article on digg

Comments

19 Comments on “Wordpress: Solving The YouTube Problem” so far

  1. redwall_hp Says:

    It’s the WYSIWYG editor that’s doing it. If you’re never going to edit a post again, than you technically can just paste it into the code tab, then publish. The problem is, if you ever open the post in WYSIWYG mode again (or just switch the tab after pasting the code), Wordpress will strip it out.

    It gets worse in Wordpress MU, where WPMU totally blocks any code it doesn’t recognize for “security reasons”. That includes YouTube videos.

    Plugins seem to be the best option for now. At least until Wordpress supports YouTube natively.

  2. Blogsolid Says:

    I just tested it, and you’re right, redwall, if you place the YouTube embed code in the code tab and publish immediately, it does work!
    The problem, as you pointed out, is that if you go back and edit the post again, it seems to break…

  3. redwall_hp Says:

    Yeah, that’s always been one of the most annoying Wordpress “features” (read: bugs). Pretty much every other platform supports YouTube, and any other flash-based video site. It’s about time they fix it. Yes, plugins work okay, but you can’t see the video in the post editor while you write accompanying text. Wordpress needs a new editor. TinyMCE works okay, but it’s a big pain with stuff like videos (it also likes to “fix” code you wrote, replacing DIVs with Ps and things like that).

  4. Memo Says:

    That’s one of the reasons why I use a blog desktop client, as I find the WYSIWYG editor included in Wordpress annoying and basically useless. For example, I hate when it refuses to automatically break a line breaking the layout.

  5. Blogsolid Says:

    Hi Memo
    Can you recommend a desktop client that works well with Wordpress?

  6. Wes Says:

    I actually recommend Viper’s Video Quicktags.

    It puts in buttons for videos from several video sharing sites. Also, it doesn’t seem to break when you edit it, since it uses its own special tags.

    As for a desktop client for Wordpress, I’ve used w.Bloggar with some success, tried out Ecto liked it, but it wasn’t free; and also tried out BlogJet and liked it but once again it wasn’t free.

    In the end, I came to the conclusion that software isn’t really worth the time considering you can disable the WYSIWYG (or WYSIWTF) view.

  7. Blogsolid Says:

    Haha, thanks Wes, WYSIWTF is quite accurate!

  8. redwall_hp Says:

    I say we just go over to http://wordpress.org/extend/ideas/ and demand a new WYSIWYG editor. :D

    Actually, there have been people doing just that. I believe it’s actually being considered, though who knows when we’ll get it.

  9. BlogBuzz September 8, 2007 » Webmaster-Source Says:

    […] think yesterday was “Wordpress Irritation Day.” Blogsolid.com penned a post on making YouTube videos work in Wordpress. Later that day, BookAdvice.net’s Wordpress installation started acting up. It seems that […]

  10. Blogsolid Says:

    I did not manage to download Viper’s Video Quicktags plugin from the link above, so here’s a link to the wordpress plugin page for Viper’s Video Quicktags.

  11. Myo Kyaw Htun Says:

    Seriously, Wordpress Tiny MCE editor always change the object embed code every time i paste in editor. That makes my site invalid XHTML. Now what I did it, I embed flash code by using Adsense deluxe plugin. That’s pretty work for me.

  12. Jeff Says:

    Hey everybody-
    My solution to the issue was first to dl Firefox, which I only use for blog posting, and then the above solution you have is correct. Whenever I post a video, I click ’save and continue editing’. You will be able to jump back into the code after that and continue editing. Hope this helps a little.

    -jv

  13. Googlelady Says:

    This video step-by-step on how to embeded yourtube videos in wordpress:
    http://www.blognetize.com/26/e.....wordpress/

    No need of a plugin.

  14. rest Says:

    an? what you think about teachertube?

  15. www.portakal.in Says:

    thanks

  16. fudge.org » Blog Archive » Embedding YouTube video in WordPress Says:

    […] Result: Newlines are being added somehow by the editor (and the ampersand converted as well) and crushing out the object tag and impacting a div somewhere else which causes further page rendering to be centered. Ick. […]

  17. youtube traffic Says:

    thank you for such a great topic. I have learned a lot by reading on this website today.

  18. prashant Says:

    Thanks a lot. Used this in my blog, I was facing the same problem.

  19. Colleen Says:

    I’m running WordPress MU for my blog, and my code was stripped too. Here’s how you can edit MU to keep the code from being stripped.

    Open this file: wp-includes > ksep.php

    Look for a line like this: if (!CUSTOM_TAGS) {

    Add the following two (I put them in alphabetical order with the existing allowed tags)

    ‘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()),