View on website:
scottsweb.dev/how-to-embed-youtube-videos-on-wordp…
In this video, I show you how to load a youtube video/embed in your wordpress page or post, without negatively affecting your PageSpeed score.
Just one youtube video, loaded the normal way in gutenberg editor can drop your pagespeed score by 60 points or more.
Using this method, we only load the video when a user scrolls or moves their mouse. There will be a placeholder that you can style in the case a user does not move their mouse.
We do this by creating a shortcode called load_youtube and setting the data-src of the youtube iframe instead of src. Then, we have javascript switch out the data-src for src.
To copy the code, please visit the webpage directly:
scottsweb.dev/how-to-embed-youtube-videos-on-wordp…
コメント