WordPress 4.8 brought about a number of new widgets, including an improved text widget, as well as audio, image, and video widgets. When I first started playing around with the video widget it wasn’t clear how to add YouTube videos to the new WordPress video widget. Hopefully, if you are having the same issue, you can benefit from these tips.
How to add a YouTube video in the new WordPress video widget
When you first open a new WordPress video widget, you’ll see a button to add a new video. Clicking on that button opens up the media library, which feels like you should be uploading a video. What gives? Why can’t I use a YouTube video?
If you pay attention, to the left side of the Add Video window, click the link that says Insert from URL.
Here, you can copy and paste your YouTube video’s URL into the box. Then click the Add to Widget button at the bottom right side of the window.
Adjusting the Video Settings
By default, when entering a YouTube video’s URL in the box, you may end up with some unwanted features, such as:
- Showing suggested videos when your video finishes
- Showing the player controls
- Show video title and player actions
While this may be fine for your purposes, in many cases it won’t be. If it’s fine for you, you can stop reading. I have nothing more for you. 🙂
Modify the video output
YouTube has a way that you can modify the URL by adding a query string to the end of the original URL you added earlier that will fix these problems.
To get the query string, below your video, click the Share button. Next, click on the Embed tab in the box that opens up below.
You will see a preview of your video and below that a few boxes. Uncheck the boxes that you do not want to have applied to your embedded video in the WordPress video widget.
Next, in the iframe embed code, you’ll see a section that says src=”https://youtube.com/embed/….”
Follow that until you hit a question mark (?). Copy everything after the question mark, and before the next double quote (“). Depending on which boxes you have checked, the value you will be copying will vary, but it may look something like this:
rel=0&showinfo=0
Next, go back to the Insert from URL screen on your new WordPress video widget. Type an ampersand (&) after the YouTube video’s URL, then paste the query string that you just copied from the embed.
So, you’ll need to enter three things into the Insert from URL box:
- The YouTube video’s URL. Take this from your browser’s address bar, not from the iframe embed code. For some reason when I used the URL from the embed code, it didn’t recognize the video format and gave me some errors.
- Type an ampersand (&) after the YouTube video’s URL.
- Paste the query string that you copied out of the embed code.
That’s it! You should now be able to add YouTube videos to the new WordPress video widget on your site.
Terry D’Entremont says
Thanks for this, Scott, but every attempt to add the YouTube URL, with or without adding to the string, fails. I just can’t get this to work. Any ideas?
Carlos Caso-Rosendi says
not true. YouTube videos are no longer accepted by WP. Who knows why. The videos already posted to my sidebar are still there but I cannot post any new ones.