How to Add Lazy Load to Videos
WordPress Tutorials & How-To (Advanced)
How to Add Lazy Load to Videos in WordPress
Embedded videos slow down your website by loading heavy scripts, thumbnails, and iframes on page load. Lazy loading ensures videos load only when the user scrolls to them — improving PageSpeed, Core Web Vitals, and overall performance. This advanced guide shows how to add lazy load to YouTube, Vimeo, and self-hosted videos using plugins, Elementor, and custom code.
1
Why Lazy Load Videos?
Improve loading speed & reduce heavy scripts.
YouTube iFrames load multiple heavy scripts:
- YouTube player JS
- Tracking scripts
- High-resolution thumbnails
- Media preloading
Lazy loading helps:
- Increase Google PageSpeed score
- Reduce initial page load time
- Improve Core Web Vitals (Largest Contentful Paint)
- Delay video scripts until needed
YouTube videos are one of the biggest performance killers — lazy load fixes that.
2
Method 1 — Lazy Load Videos Using Elementor
Elementor has built-in lazy loading for videos.
Step-by-Step:
- Edit page with Elementor
- Add the Video Widget
- Scroll down to Additional Options
- Enable Image Overlay
When the image overlay is enabled, Elementor automatically lazy loads the video iFrame.
Recommended Settings:
- Use optimized thumbnail image
- Add play button overlay
- Disable YouTube related videos
- Disable autoplay if not needed
This speeds up pages drastically.
3
Method 2 — Lazy Load Using WP Rocket
One of the best performance plugins.
Steps:
- Install WP Rocket
- Go to WP Rocket → Media
- Enable:
- LazyLoad for iFrames
- Replace YouTube iFrame with Preview Image
WP Rocket replaces iframes with a light, clickable preview image — fastest possible solution.
Bonus Features:
- Delay YouTube scripts
- Delay JavaScript execution
- Remove unused CSS
Perfect for media-heavy websites.
4
Method 3 — Lazy Load Using Litespeed Cache
Great for Litespeed servers.
Go to LiteSpeed Cache → Page Optimization → Media.
Enable:
- Lazy Load Images
- Lazy Load Iframes
- Lazy Load Inline Background Images
Litespeed automatically lazy loads YouTube, Vimeo & iframe-based embeds.
5
Method 4 — Lazy Load With WP YouTube Lyte
Lightweight plugin for performance junkies.
WP YouTube Lyte replaces the full video embed with a super-light clickable preview.
Steps:
- Install WP YouTube Lyte
- Go to Settings → WP YouTube Lyte
- Enable:
- Lazy Load Videos
- Cache Thumbnails
Videos load only when the user clicks.
6
Method 5 — Add Lazy Load to Videos Using Custom Code
For developers who want full control.
This method replaces YouTube iframe with a preview image and loads video on click.
Add this HTML:
Add this CSS:
.lazy-video {
position: relative;
cursor: pointer;
background-size: cover;
background-position: center;
}
.play-button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Add this JS:
document.addEventListener("DOMContentLoaded", function() {
var videos = document.querySelectorAll(".lazy-video");
videos.forEach(function(video) {
var image = new Image();
image.src = "https://img.youtube.com/vi/" + video.dataset.embed + "/hqdefault.jpg";
image.addEventListener("load", function() {
video.appendChild(image);
});
video.addEventListener("click", function() {
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://www.youtube.com/embed/" + video.dataset.embed + "?autoplay=1");
iframe.setAttribute("frameborder", "0");
iframe.setAttribute("allowfullscreen", "1");
this.innerHTML = "";
this.appendChild(iframe);
});
});
});
This is the fastest lazy load method for YouTube embeds.
7
Lazy Load for Self-Hosted Videos
mp4, webm, ogv — video tags.
Self-hosted videos can be lazy loaded using a preview image & click-to-load technique.
Basic HTML for lazy loading:
Use preload=”none” to prevent auto-downloading the video.
8
Lazy Load Vimeo Videos
Same performance steps apply.
Methods:
- Enable lazyload in Elementor video widget
- WP Rocket lazy load iframes
- LiteSpeed lazy load iFrames
- Custom JS lazy load
Vimeo loads more scripts than YouTube — lazy loading is essential.
9
Best Practices for Lazy Loading Videos
Improve performance further.
- Use compressed thumbnails (20–40 KB)
- Limit number of embedded videos per page
- Enable “delay JS” for YouTube scripts
- Use image overlays for Elementor
- Avoid autoplay videos (affects LCP & CLS)
- Use shortcodes instead of iFrames when possible
Want a Fast, Video-Optimized Website?
All SiteCrafted premium websites come with professional lazy loading, optimized embeds, caching, and Core Web Vitals enhancements for maximum speed.









