Methods To Embed And Optimize YouTube Videos In WordPress

With billions of users and videos, YouTube is the largest video-sharing platform on the internet. A lot of website owners and content creators upload their YouTube videos and embed them on their blogs or websites. Millions of websites, including blogs, businesses, and media outlets, utilize the well-known content management system WordPress. 

WordPress websites that include YouTube videos may be an effective way to engage visitors and elevate the quality of your content. On the other side, it could be taxing to optimize these films for quicker load times and a better user experience. If you find yourself in this situation, don’t worry! 

We’ll explore a few methods for optimizing and embedding YouTube videos in WordPress. After reading this post, you won’t have to be worried about how quickly or effectively you can add and optimize video content to your website.

Benefits of Embedding and Optimizing YouTube Videos on WordPress

To really benefit from video content, your WordPress website must optimize and embed your YouTube videos. Make sure your video is optimized for faster response times in addition to making sure it is appropriately incorporated into the website.

Why is this important? There are a few major advantages to optimizing your YouTube videos:

  • Increased User Engagement: Videos are a very engaging kind of content that may help draw viewers to your website and increase user engagement.
  • Better Content Quality: By integrating high-caliber YouTube videos into your WordPress website, you may improve the quality of your content overall and provide your users access to more insightful content.
  • Faster Load Times: By optimizing your YouTube videos, you may speed up the user experience by lowering page load times and improving video loading times.

This means people can easily find and watch the content you’ve created without worrying about laggy pages and slow loading, as long as you’ve done the right optimization! 

Methods to Embed a YouTube Video on WordPress

Embedding YouTube videos on your WordPress website is a simple task and does not take very long. There are 3 different methods to do so, with certain methods offering better customization than others. Let us take a look at each of them:

Method 1: Embed the video using a link

Copy the video link from YouTube

The first step to embedding a YouTube video onto your WordPress website is to find the specific video you wish to use. Once you have done that, locate and copy the ‘Share’ link from the YouTube page. 

Insert the copied link into your WooCommerce page

You will then go back to your WordPress site and paste this link wherever you would like it. This is a very simple method and can be done in minutes.

Frontend view of method 1

Method 2: Embed the video using HTML

If you would like to customize the player’s size or add controls, then an HTML code can be used instead of just pasting the Share link. To create this code:

  • Navigate to your YouTube video page.
  • Click Share located under the video.
  • Select Embed from the options provided.

Select Embed from the options provided

  • Copy the HTML code beneath it.

Copy the HTML code

  • Paste it into your WordPress website in the desired position.

Paste the code into your WordPress website in the desired position

  • Make sure to save any changes you make.

Frontend view of method 2

Method 3: Embed the video using a plugin

Using a plugin like ELEX Embed YouTube Video Gallery, you can easily add videos to your WooCommerce stores’ pages, automating the majority of the process. This method allows you to simply search for video galleries and use their shortcode to have them displayed on your website with no further effort.

ELEX Embed YouTube Video Gallery plugin

You may further customize the appearance of the embedded video by selecting different sizes, colors, and layouts. After installing and activating the plugin, follow the instructions below to adjust the plugin settings.

Access the plugin settings by going to WordPress Dashboard > ELEX YouTube Gallery.

  • Settings Tab

Navigate to Configurations Settings after you’ve accessed the settings tab. To begin getting data from YouTube, enter the YouTube API key in the setup settings of this page. In order to have the YouTube API automatically download any new uploads you make to the playlists or channels in your feed, you may also enable auto sync. 

Configuration settings

When you activate Auto Sync, you may plan auto syncs for daily, weekly, monthly, or bimonthly intervals.

Under the respective tabs, set the default Video Player Settings and Gallery Settings.

In the video player settings, you may select the overlay color and blur as well as the pop-up and inline play modes. Here, you can also define the default options for the global video player.

Video Player Settings

The default gallery settings, such as whether to display the header or the YouTube subscribe button, how to define the channel URL for the subscribe button, how to pick the layout and pagination mechanism, and so on, may then be adjusted.

Gallery Settings

  • Create Tab

After adding a gallery name and category to the Create tab, enter the source URLs for the videos, playlists, or channels you wish to include in the gallery and click Add to the source list.

Create a gallery in the Create tab

You can see how the gallery will look when it is uploaded by utilizing the Live Preview tool. The source list, color mode, desktop design, subscribe button, and intro video may all be changed on this page.

utilize the Live Preview tool

  • My Gallery

Under my gallery, you can find the shortcodes for each of the freshly created YouTube video galleries.

Under my gallery, you can find the shortcodes for the created YouTube video galleries

You can easily add the gallery to your WordPress website by copying and pasting this shortcode into the WordPress page’s backend. Shortcodes can be selected by clicking “+” in the block editor’s drop-down menu.

Insert the shortcode into your WordPress editor

After inserting the copied shortcode, click Update. You may display one or more video galleries from your YouTube account by following these simple instructions. 

Frontend view of the inserted YouTube video gallery

  • Adding the video to the product image gallery

The process is simple and does not require any additional tools. Once the ELEX Embed YouTube Video Gallery plugin is activated, you may navigate to Products > All Products from your WordPress Dashboard. 

To enter the Gutenberg editor, choose the product to which you want to add YouTube videos and then click the Edit button

To enter the Gutenberg editor, choose the product to which you want to add YouTube videos and then click the Edit button.

In the editor, navigate to the ELEX YouTube Video Gallery window. The window will show on the page’s right side.

Navigate to the ELEX YouTube Video Gallery window

In the window, you’ll see a field where you may enter the YouTube video URL. Enter the URL of the YouTube video and click the arrow to add it to the product image gallery.

Insert the YouTube video links into the box

The YouTube video will now be included in the product image gallery. Repeat the procedure to add more YouTube videos. Additionally, you may also choose whether to include the videos at the start or end of the gallery.

Frontend view of the YouTube video inserted into the product image gallery

With these methods, your embedded YouTube videos should appear on your WordPress website exactly how you had intended them to!

Optimizing YouTube Video on WordPress

Using the ELEX Optimize YouTube Videos Embed Plugin for WordPress to optimize videos, you can make sure that your pages and videos load quickly and efficiently. This will give you an edge over other websites in terms of page speed resulting in customer satisfaction.

ELEX Optimize YouTube Videos Embed Plugin for WordPress plugin

The process is very simple, start by installing and activating the plugin just like you would with any other plugin. Once the plugin is activated, follow any of the following methods to optimize the video with or without a custom banner.

Method 1: Optimize and embed with a custom banner 

Head over to any of the pages you wish to embed an optimized YouTube video and insert the following shortcode:

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

The above-provided shortcode can be customized by adding the necessary details such as 

  • Video Link
  • Banner Image URL
  • Alternate Text
  • Video Dimensions

Below is an example of an optimized YouTube video with a custom banner.

Frontend view of an optimized YouTube video with a custom banner

Method 2: Optimize and embed without a custom banner 

The process is similar to method 1 with a slight change in the shortcode. Head over to any of the pages you wish to embed an optimized YouTube video and insert the following shortcode:

[eh_optimize_youtube_embed video=””]

Insert the above shortcode with the YouTube link in any of your WordPress pages and click Update. The video will appear with the default YouTube play button and no banner as you can see below.

Frontend view of an optimized YouTube video with no banner

When you use any of the above methods with the plugin, the YouTube video will appear as shown above without the inline frame. When a customer clicks on the banner, it will open up the YouTube video.

This optimization increases the loading and response speed of your web pages with YouTube videos. Below you can see the before and after results of using the ELEX Optimize YouTube Videos Embed Plugin.

Before and After results of using the ELEX Optimize YouTube Videos Embed Plugin


In summary, YouTube videos are a great asset for your WordPress website, and there are many ways that you can optimize your videos to make sure they are as effective as possible. 

Embedding and optimizing videos in WordPress is relatively simple, and the ELEX plugins provided above can help automate the majority of the process. Whatever method you choose to embed and optimize videos, the goal should be to make them as engaging and informative as possible. Your customers will appreciate the effort and your website will benefit from the additional traffic. 

We hope this post has helped you understand the process better!

Further Reading

Popular Tags

Blog Business Case Code Snippet Documentation ELEX Address Validation & Google Address Autocomplete Plugin for WooCommerce ELEX Amazon Payments Gateway for WooCommerce ELEX Payment Gateway for WooCommerce ELEX Bulk Edit Products, Prices & Attributes for WooCommerce ELEX Dynamic Pricing and Discounts Plugin for WooCommerce ELEX EasyPost Auto-Generate & Email Labels Add-On ELEX EasyPost Shipping Method Plugin for WooCommerce ELEX Google Product Feed Plugin ELEX Hide WooCommerce Shipping Methods Plugin ELEX ShipEngine Multi-Carrier Shipping & Label Printing Plugin for WooCommerce ELEX Shipping Plugin with USPS Postage for WooCommerce ELEX USPS Auto-Generate & Email Labels Add-On ELEX WooCommerce Abandoned Cart Recovery with Dynamic Coupons ELEX WooCommerce Australia Post Bulk Label Printing Add-On ELEX WooCommerce Australia Post Shipping Plugin with Print Label & Tracking ELEX WooCommerce Catalog Feed for Facebook & Instagram ELEX WooCommerce Catalog Mode, Wholesale & Role Based Pricing ELEX WooCommerce Choose Your Delivery Date Plugin ELEX WooCommerce DHL Express / eCommerce / Paket Shipping Plugin with Print Label ELEX WooCommerce DHL Express Bulk Label Printing Add-On ELEX WooCommerce Discount per Payment Method Plugin ELEX WooCommerce EasyPost Bulk Label Printing Add-On ELEX WooCommerce EasyPost Return Label Add-On ELEX WooCommerce Name Your Price Plugin ELEX WooCommerce Product Price Custom Text (Before & After Text) and Discount Plugin ELEX WooCommerce Bulk Label Printing Add-On ELEX WooCommerce USPS Shipping Plugin with Print Label ELEX WooCommerce Request a Quote plugin for WooCommerce ELEX WordPress Embed YouTube Video Gallery ELEX WordPress Embed YouTube Video Gallery Plugin FAQ Getting Started Knowledge Base Open Source HelpDesk & Customer Support Ticketing System – Simple & Flexible Plugin Integrations ReachShip WooCommerce Multi-Carrier & Conditional Shipping Plugin Shipping Plugins Uncategorized WooCommerce WSChat - WordPress Live Chat Plugin WSDesk - WordPress Helpdesk Plugin