Suggestion: Video Thumbnails for youtube-nocookie.com

[ad_1]

Hi, just a quick suggestion:
Include youtube-nocookie.com in your script that loads video thumbnails. Embeds work the same and you can still use the same thumbnail url starting with ;

Maybe a bit of a fringe case, but I have hope that this isn’t too hard to implement.

On my site I convert any standard youtube embed into nocookie with this script:

// Add this to your plugin or functions.php file of your theme

function youtube_add_nocookie( $cached_html, $url, $attr, $post_id ) {
    if ( preg_match('#https?://(www\.)?youtu#i', $url) ) {
		return preg_replace(
			'#src=(["\'])(https?:)?//(www\.)?youtube\.com#i',
			'src=$1$2//$3youtube-nocookie.com',
			$cached_html
		);
	}
	return $cached_html;
}

add_filter( 'embed_oembed_html', 'youtube_add_nocookie', 99, 4 );

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer