WordPress YouTube Widget

Number 7 in Widget-A-Day is a YouTube widget.

It’ll display a YouTube video in the sidebar. Just enter the URL of the video, and it’ll show in the sidebar. You can change the width and height, and make it autoplay or not.

Download youtube.zip

SVN Checkout
svn co http://svn.wp-plugins.org/youtube-widget/trunk

Default display:

Admin panel:



  1. Download youtube.zip
  2. Extract and upload youtube.php to the plugins/ directory
  3. Enable YouTube Widget in the Plugin admin panel
  4. In widget admin panel, place YouTube in the sidebar, and edit it to enter the YouTube URL, not the embed code

Download youtube.zip


  1. Is there a way to use multiple instances of this? Or is there another plugin with that functionality?

    This question was asked above but I wasn’t clear on the answer. thanks for this.

  2. The removing of the YouTube URL is quite dumb. It should be a reg-ex, but I got lazy. If anything is slightly different with the URL, even case wise, it won’t work right.

  3. thanks. this is a nice plugin. do you know if you will be adding any extras. will the plugin be developed. a future which would automatically update you tube videos would be useful. thanks

  4. HI, thanks for the plugin, I have a problem with it as it show me this error:

    Warning: array_slice() expects parameter 1 to be array, null given

    were all the errors in the php have this:

    $items = array_slice($feed->items, 0, $maxitems);
    foreach ($items as $item)

    any help?

    Running WP 2.6.5

  5. I saw this question before but didn’t see an answer. Is there any way to get this widget to go up on a sidebar more than once?

    Great widget!

  6. I would like to use this plugin as want display only on certain pages? some sort of if{condition} any help or guide pls?


  7. It gives me the following error:

    Fatal error: Call to undefined function: str_ireplace() in /var/www/vhost/mas-memory.com/home/html/somos/wp-content/plugins/youtube.php on line 111

    How can I fix this?


  8. I know this isn’t a great fix, but for multiple instances of this plugin, I just copied the plugin file, went through the whole code and replaced every “youtube” into “youtube2” in all the code and everything. I then uploaded the copy in to the plugins folder and activated my new “Youtube2” plugin. Not a great fix, but I only needed two instances of it anyway.

  9. Hi James,

    Just downloaded and uploaded this Plugin.
    It’s activated in the PLugins section.
    Under the Widgets section it appears but it wont let me ‘add’ it to the sidebar as the ‘Save’ button disappears and therefore wont allow me to save or activate it.
    I’ve tried doing it a few times but cant get it to work.

    I have WordPress version 2.7.1 on the site that I have currently installed this plugin.

    What should I try??

  10. Hi James,
    I downloaded your You Tube plugin, but Í’ve got problems using it. I’m using the fusion theme. At the widgets page the YouTube widget is shown. If I click on ‘add’, the ‘current widgets’ disappear, and the “save chacges button” as well. Do you have any idea how to solve this problem?

    Thanx in advance, Barbara

  11. Hi,

    Am trying to load your youtube widget to the site. Will it work with WP 2.7.1? If not, is there another youtube widget you could recommend.


  12. Am running WP version 2.8. Cannot drag from available widget column to the sidebar. Any comments on what to do??? Thanks

  13. Sorry James…

    I used this widget for a week before I realized that I could accomplish the same exact thing by using a regular text widget and putting the embed code from youtube into it. It was much easier to use, I can have multiple instances and I know that it will always be compatible.

  14. I see others w/ same problem – your widget will not drag to sidebar.

    pasting you tube code to text widget doesn’t work either. I’m missing sometuning here

    paste code to text widget and all sidebars disappear.

    I find that the kiss of death when you geeks tell me how easy it is.
    The more you use the word ‘easy’ the more trouble I’m in.

  15. I installed this but I was getting ‘call to undefined function str_ireplace(). This function is only available in php5. So I went to plugin editor, and changed str_ireplace to str_replace and it worked (str_replace IS php4 compatible)

  16. just a quick question, ive installed this plugin and used the widget in my sidebar, only thing bugging me is that the thumbnails and titles are left aligned…ive tried styling all the and elements of the widget in my css file and aliging them to center and auto margins etc but nothing seems to work…any suggestions?

    Thanks a lot 🙂


  17. Had the same problem as Andy (September 18, 2009 at 7:23 am) and the replacement of str_ireplace to str_replace worked perfectly.

  18. Hello james! I am having problem with sliding you tube wideget to the right.Can you assist me with this?What should i do?

  19. hi james,
    thanks for the widget. i just wanted to know how i can add to two extra
    fiels after titel (company and comment). I am a total beginner in php
    thanks for your help


  20. Thanks for the great widget! How do you get the plugin to appear on the sidebar more than once? When I move the YouTube widget to the side bar it disappears from the “available widgets” section.

    Please HELP!

    all the best,

  21. hi…. got the widget installed… can’t drag it to the sidebar tho…. any fix for this?

  22. This widget is working great for me in mozilla but not in Internet Explorer. I get a red X in explorer. Also is there a way to have multiple widgets. I would like to use the widget it both my homepage sidebar and my page sidebar

  23. I am creating a new website for an exsiting one and when I do the widget it shows the video twice, directly under each other.

    This is great if it could be two different videos, but it’s the same video and on autoplay the 2nd delays start after 2-3 seconds after the 1st, which is annoying to hear, and not really how I want the site to look.