How to Embed YouTube Videos in WordPress (And 2 Creative Ways to Use Them)(with Video)

Last updated - June 25, 2020

A few years ago, video was an expensive marketing tool privy to only the biggest agencies and brands. But since then, video has proved its value as the extremely flexible medium with high returns on value.

Today, marketers around the world use video to showcase products and services, help customers, give a human touch to content, and grab more eyeballs. And we regularly see it in action on two of the biggest platforms for content creation and marketing — WordPress and YouTube.

Recognizing this, both platforms have made it incredibly easy for anyone — knowledgeable about coding or not — to embed YouTube videos in WordPress. This blog will explain some of the easiest and most effective methods of embedding YouTube videos in WordPress. And a few tips in the end will let you in on some creative ways to use your YouTube-WordPress content.

Embed YouTube Videos Using the oEmbed Method

The easiest way to embed YouTube videos in WordPress is by using the oEmbed method. oEmbed is a protocol that lets you embed videos, images, and text from one site to another just by using the source URL.

Here’s how you do it:

  1. Go to YouTube and find the video you want to embed.
  2. Select the URL at the top of the browser and copy it entirely.
  3. Then, go to your WordPress visual editor and place the cursor where you want the video to appear.
  4. Paste the video’s URL and let WordPress automatically convert it into an embedded video.
video with white background and text
Pasting a video URL automatically turns it into an embedded video.

Yes, it’s that easy. Just make sure you keep these guidelines in mind while using the oEmbed method:

  • Place the embed link in its own line. This means there should be no text or whitespace before or after the link.
  • Don’t add alignment or style elements to the URL. This can envelop the URL in HTML formatting and cancel the embed.
  • Only links to videos or playlists are accepted. Don’t paste the URL of a YouTube channel.

Embed YouTube Videos Using the Iframe Method

While the oEmbed method is simple to follow, it doesn’t give you any customization options to play with. You can’t disable the embedded video’s player controls, nor can you set it on autoplay.

This is where Iframe comes in. This embedding method lets you control exactly how you want the video to look and work on your WordPress website. You’ll have to follow a few extra steps:

  1. Click on the Share button below the YouTube video you want on your WordPress page.
  2. Then, click on the Embed button.
  3. Here, you’ll find the iframe embed code along with a few customizable options.
  4. If you want the video to start at a certain point, pause the video at that point and enable the ‘Start at’ option.
  5. You can also manage player controls and privacy-enhanced mode just below.
  6. Next, copy the embed code and head back to your WordPress website.
  7. Switch from your visual editor to text editor and paste the embed code.
  8. Update the post and WordPress will convert into an embedded video.
image with black background and white text.
YouTube’s iframe embed method offers customizable options.

Embed YouTube Videos Using Online Embed Tools

While the iframe method itself comes with a long list of customization options for embedding videos, YouTube doesn’t include them all. Even the ‘Developer Sample’ section in YouTube is limited to a few extra customization options.

To take advantage of everything the iframe method has to offer, you can try online YouTube video embedding tools like YouTube Video Embed. The website lets you make a long list of customizations and spits out a code you can directly copy into your WordPress text editor.

Just paste the video URL, play around with the embedding options, and copy and paste the iframe code. Here are some embed options you can expect at YouTube Video Embed:

  • Autoplay video – Play the video automatically when the webpage opens.
  • Loop video – The embedded video plays on loop repeatedly.
  • Show Annotations – Enable or disable text annotations in the video.
  • Allow fullscreen – VIewers can or cannot watch the video in fullscreen.
  • Closed captions – Enable or disable closed captions on the video.
  • Progress bar – The progress bar is visible throughout the video or autohides after a certain time.
  • Related videos – Enable or disable YouTube from showing related videos at the end of the video.
  • Video title – Control the visibility of the video’s text title.
  • Start time – Time at which the video starts.
  • End time – Time at which the video ends.
  • Layout – The video’s dimensions remain fixed or change according to the screen size.
  • Alignment – The video can be aligned to the left, center, or right.
  • Aspect ratio – The video’s aspect ratio can be 16:9, 4:3, or 1:1.
  • Width and Height – The video’s dimensions in pixels.
Image with white background, image, and text.
YouTube Video Embed lets you make a long list of embed customizations with ease.

Optimizing Embedded Pages

Embedded YouTube videos make up a significant part of a web page’s page weight. This is why performance metrics will show an increase in page load times after you’ve embedded a video. This happens because every time a visitor’s browser has to render your page, a number of extra requests have to be made.

Requests for multiple resolutions, images, and other assets slow down the page. And if you have two or more videos on your page, all of your page optimization techniques won’t mean much.

An easy solution to this problem is lazy loading your embedded YouTube videos. Lazy loading is a technique that only loads essential resources at page load time. Other less critical resources like embedded videos are only loaded when the user clicks on the play button.

Note: Lazy loading cannot work if the embedded YouTube video is set to autoplay.

Shying away from lazy loading guarantees a wastage of user data, processing time, battery time, and other system resources. But with a good lazy loading plugin installed, you can reduce initial page weight, system resource usage, and initial page weight, all of which improve your website performance.

The ELEX Optimize YouTube Videos Embed Plugin for WordPress is a good tool for the purpose. The plugin mimics an embedded video using a preset banner and YouTube icon but only loads embedded videos after the visitor clicks.

You can download the free plugin from Elextensions and install it on your WordPress website. The plugin comes with a shortcode you can use to embed the video. Just supply the video URL and the banner image link and you’re good to go.

The shortcode is: [eh_optimize_youtube_embed video=”VIDEO LINK” banner=”IMAGE URL” alternate_text=”ALTERNATE TEXT” width=”560″ height=”315″]

Black text on white background
ELEX’s video optimization tool lets you lazy load videos with a simple shortcode.

Embedding Videos in Sidebar

A creative way to use YouTube videos in WordPress is to embed them in your sidebar. Instead of populating your sidebar with recent post suggestions in the text form, you can use videos to keep them engaged and on your site. The process to embed YouTube videos in your sidebar is easy.

Video with black text on white background.
Videos in sidebar are great for catching visitors’ attention.

In your admin dashboard, hover over ‘Appearance’ and click on ‘Customize’. Then, click on ‘Widgets’, choose the sidebar, and click on ‘Add a Widget’.

In the search box, type video and click on the result. The video widget will be added to your sidebar. Now, you just need to ‘Add a video’. Choose ‘Insert from URL’ from the pop-up.

Paste the video link, wait for the video preview, and click on ‘Add to Widget’. Finally, click ‘Publish’ to take it live.

Making a Video Gallery on WordPress

Another creative use of YouTube embeds is making a video gallery on WordPress. If your brand has a dedicated YouTube channel of its own, you can streamline your content marketing efforts by showcasing your entire channel on your website.

VIdeo showing Learnwoo's video gallery.
Learnwoo’s video gallery showcases its YouTube channel.

You can use plugins like Embed Plus and Envira Gallery to make your own gallery. These plugins also come with features like zip importing, live streaming, block editor compatibility, and many more to make the process effortless and automated.

With that, you now know how to embed a YouTube video in WordPress, optimize your webpage, customize your sidebar, and create a video gallery all by yourself. Do reach out to us if you have any relevant questions.

Check out the video tutorial:

Further reading