YouTube has over a billion users—almost one-third of all people on the Internet—and every day people watch hundreds of millions of hours on YouTube and generate billions of views (source). When you combine those numbers with WordPress powering 27% of the web, you’ve certainly got a match made in heaven.
It’s almost inevitable that you’ll want to embed a YouTube video on your WordPress site. This could be a marketing video for a business site, an educational or instructional video, a personal video embedded on your blog, etc. Let’s walk through the various options, and I’ll help you choose which method is best for your situation.
There are 4 main ways to embed a YouTube video in WordPress:
- Using oEmbed (easiest)
- Using the embed shortcode (a few more options)
- Using an <iframe> (a lot of customization)
- In your WordPress sidebar
We have also answered a few YouTube embed FAQs.
If you’re in a hurry, watch our YouTube video embed tutorial:
01 Easiest Way to Embed a YouTube Video in WordPress
The easiest way to embed YouTube videos in WordPress is to simply paste the URL onto your page/post edit screen. Make sure you’re using the Visual editor, and not in Text mode.
Then just paste the YouTube URL on it’s own line.
You can use the shortened, share URL: https://youtu.be/IZuTNOxTA-Q
Or use the full URL in your browser’s location bar: https://www.youtube.com/watch?v=IZuTNOxTA-Q
Either one will work.
Here’s a quick animation:
02 Embed YouTube Video in WordPress using a shortcode
If you’d like to set a maximum width or height on your video, you can use the
embed shortcode. The shortcode works in both Visual and Text mode, and has two optional parameters:
Just add the following code into your post edit screen:
Add your YouTube URL where it says “YOUTUBE URL GOES HERE,” and change the
height parameters to fit your needs.
- Remember: These are maximum dimensions, not exact. It will prevent the video from being any larger than what you define, but it could possibly display smaller.
You can also use the Media Library to add a YouTube video. This will use the same
embed shortcode as above, it’s just a different way to do it.
- Place your cursor on a new line, where you want to embed the video
- Click Add Media
- On the left, click Insert from URL
- Paste in the full watch URL or the share URL from YouTube
- Click the Insert into Post button at the bottom of the screen
03 Embed YouTube Video in WordPress using an
If you want much more flexibility over how your YouTube videos are displayed on your WordPress site, this method is for you. It’s a little more technical than the first 2 methods, but still not too difficult.
<iframe> embed method will provide you with the following options for customization:
- Fullscreen: Whether or not to allow visitors to enlarge the video to cover their entire screen
- Related Videos: Whether or not to show related videos after this video is finished playing (they are chosen by YouTube)
- Player Controls: Whether or not to show the play/pause, volume, captions, etc. buttons
- Title/Sharing: Whether or not to show the video title & sharing options
- Autoplay: Whether or not to automatically start playing the video when the page loads
- Captions: Whether or not to show video captions by default
- Start Time: Choose a specific time within the video for it to start
- Privacy: Enable advanced privacy settings
- …and more (see below)
How to use the
- On YouTube.com, navigate to the video you want to embed
- Click on Share
- Then click on Embed
- You can adjust the settings by checking the boxes below the embed preview
- Copy the code
- Go back to your WordPress editing screen, and click on the Text tab
- Paste the code on it’s own line, where you want the video to appear
How to customize YouTube video playback via the URL
Now I’ll show you how to adjust all the settings that I mentioned above.
Here is a list of URL parameters you can add to the end of the
rel=0– disables related videos at the end
controls=0– Hides the player controls (play/pause, volume, captions, settings, fullscreen, etc.) at the bottom
showinfo=0– Hides the video title & sharing options at the top
autoplay=1– Starts playing the video automatically, when the page loads
loop=1– Repeats the video, as soon as it reaches the end
mute=1– Disables the sound, by default.
disablekb=1– Disables the keyboard controls
cc_load_policy=1– Automatically turns on captions
start=60– Starts the video at a specific time (Use a positive integer denoting seconds. Ex:
start=60will start the video at the 1:00 mark.)
end=180– Stops the video at a specific time (Use a positive integer denoting seconds. Ex:
end=180will stop the video at the 3:00 mark.)
allowfullscreen– This is not a URL parameter, but you remove this attribute from the
<iframe>to disable fullscreen mode
iv_load_policy=3– Hides all video annotations
modestbranding=1– Removes the YouTube logo from the control bar
- Privacy-enhanced mode – This is done by checking the “Enable privacy-enhanced mode” checkbox. The URL changes from
How to disable fullscreen mode on a YouTube embed:
- Simply remove “allowfullscreen” from the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q" width="640" height="360" frameborder="0"></iframe>
How to disable related videos:
rel=0to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?rel=0" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to hide YouTube player controls on a video embed:
controls=0to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?controls=0" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to remove the YouTube logo on your video embed:
modestbranding=1to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?modestbranding=1" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to hide a YouTube video title & sharing options:
showinfo=0to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?showinfo=0" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to autoplay a YouTube video on page load:
autoplay=1to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?autoplay=1" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to automatically turn YouTube captions on:
cc_load_policy=1to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?cc_load_policy=1" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to set a YouTube video embed to mute by default:
mute=1to the end of the
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?mute=1" width="640" height="360" frameborder="0" allowfullscreen></iframe>
How to start a YouTube video at a specific time (ex: 1:00):
- Convert the time into total seconds
start=60to the end of the
srcURL (60 seconds = 1 minute)
<iframe src="https://www.youtube.com/embed/IZuTNOxTA-Q?start=60" width="640" height="360" frameborder="0" allowfullscreen></iframe>
04 How to Embed a YouTube Video in your WordPress Sidebar
As of WordPress 4.8, there’s a new video widget that makes embedding a YouTube video in your sidebar a breeze. Let’s take a look at how to set it up.
- Navigate to Appearance > Customize (you could also go to Widgets, but Customize shows you a real-time preview)
- Click on Widgets
- Then find the sidebar area that you want to add the video to (you might have multiple sidebar areas listed)
- Click Add Widget
- Search for the Video widget, and click on it
- Click the Add Video button
- On the left, click Insert from URL
- Then paste the YouTube video URL into the box
- You’ll see a preview of your video
- Click the Add to Widget button
- At the top of the Customizer, click Save & Publish
YouTube Video Embed Not Working?
The most common issue we’ve seen for a WordPress YouTube video embed not working is that the video creator has disabled embedding. When the creator chooses this option, you have to go to youtube.com to watch the video.
You will first notice that embedding has been disabled because the “EMBED” option under the “Share” menu will be greyed out:
If you’ve already tried to embed the video within WordPress, pull up the page that it’s on. You’ll likely see this message:
“Watch this video on YouTube.
Playback on other devices has been disabled by the video owner.”
There isn’t much you can do. Video owners reserve the right to allow or forbid their videos to be embedded on other websites.
- Reach out to the video owner and ask if they’ll allow you to embed it
- Ask them if they’ll provide a form of the video you can upload on your own YouTube channel
- Embed or insert some other multimedia content that gets your point across
- Take screenshots of the video and include those instead (always link back to the video, and it’d be nice if you let the original creator know)
WordPress YouTube Video FAQ
- Can I include comments with my YouTube video embed?
- No. YouTube only allows you to embed the video itself. You cannot embed a video’s comments.
- Can I include the video description with my YouTube embed?
- No, you cannot include the description of a YouTube video embed. Only the video itself can be embedded.
- Can I remove the YouTube logo from my video embed?
- Yes. In your embed code, add the
modestbranding=1parameter to the end of your
If you have any trouble embedding a YouTube video on your WordPress site, please let me know in the comments and I’ll try to help out.