youtube and wordpress

How to Embed YouTube Videos in WordPress

Last Updated on April 20, 2022 by WP Knowledge Hub

If you want to use videos to bring your website to life because you want to increase user engagement, WordPress makes it super easy.

You can embed videos from sites like YouTube, Vimeo, or social media sites like Facebook and Twitter.

Let’s start by taking a look at how we can embed videos in WordPress posts, pages, and widgets.

Why Use Videos on Your WordPress website?

If you want to capture your visitor’s attention and boost engagement and conversions, adding videos to your WordPress blog is a great way to do that.

Most users will prefer watching a video to reading written text, therefore having videos on your website will help to increase the time your users spend on it.

Should You Upload Videos Directly to Your WordPress Media Library?

Although you can technically do this, it’s not recommended that you do.

The majority of websites use shared hosting accounts, and videos will use up a lot of server resources. The most important resource videos will use up is called bandwidth. If many visitors are watching your video at the same time, it might consume all of your server’s bandwidth and crash your website.

Not only that, but you are missing out on potential revenue from YouTube or other video sites.

So, let’s see what the options are:

  • Embedding videos in WordPress blog posts using Guttenberg
  • Embedding videos in WordPress blog posts using the WordPress Classic Editor
  • Embedding videos in WordPress widgets
  • Embedding videos using plugins

Embedding Videos in WordPress Blog Posts and Pages Using Guttenberg

The new WordPress block editor has a great feature called auto-embed which allows your website to automatically get the embed code from popular video hosting services like YouTube, Vimeo, etc. You simply need to paste the video URL into the WordPress editor.

For example, you can copy the YouTube URL for a video that you want to embed like this:

Then, go to the WordPress post or page you want to edit, and simply paste the URL in. When you do that, the video URL will be converted because WordPress will fetch the embed code and display the YouTube video automatically.

This doesn’t only work with Youtube videos. It also works with many other video services:

  • Amazon
  • Animoto
  • Cloudup
  • CollegeHumor
  • Crowdsignal
  • Dailymotion
  • Facebook
  • Flickr
  • Hulu
  • Imgur
  • Instagram
  • Issuu
  • Kickstarter
  • Meetup.com
  • Mixcloud
  • Reddit
  • ReverbNation
  • Screencast
  • Scribd
  • Slideshare
  • SmugMug
  • Someecards
  • SoundCloud
  • Speaker Deck
  • Spotify
  • TED
  • Tumblr
  • Twitter
  • VideoPress
  • Vimeo
  • WordPress.tv

Embedding Youtube Videos in WordPress Using the Classic Editor

Many website owners still prefer the Classic Editor to the new Guttenberg block editor, and for good reason. Unless you are building layouts like rows and columns, the WordPress Classic Editor is much simpler to use, kind of like editing text in a Word document. It might not look as pretty, but for some people that’s not as important as ease-of-use.

If you want to embed a Youtube video using the classic editor, you simply need to grab the embed code from the video hosting service and paste in anywhere in the editor.

On Youtube specifically, you’ll need to click SHARE under the video, then EMBED, then copy the code that pops up like so:

By default, the embed code will start with <iframe width=”560″... but you’ll need to change that width number to “100%” in order for the video to be responsive to its container, so it adjusts to any device size.

Embedding Videos in WordPress Widgets

WordPress videos also works in the new block widgets that replaced the classic widgets. If you go to Appearance > Widgets in your WordPress dashboard, you can simply search for ‘Video’ in the new block search bar.

After that, click on the block for the type of video you want to add, such as YouTube or Vimeo, etc.

Next, you need to paste your video URL into the box and it will automatically be added to the widget area. Make sure you update so the changes are live on your WordPress website.

Embedding Videos with Plugins

Adding more plugins to your website will most likely cause your site to take longer to load, therefore, they should only be added if absolutely necessary. The more plugins you have, the more chances you also have of causing conflicts. Plugins can conflict with the theme, with other plugins, or with WordPress itself if it’s not compatible with the latest version.

That’s why we strongly recommend not using plugins to display videos unless you are absolutely certain there is a clear advantage over the block or class editor.