Created
November 20, 2020 17:54
-
-
Save rosswintle/92cf7fa6fe8d00d763ba6b83369feb74 to your computer and use it in GitHub Desktop.
Filter to make WordPress YouTube oembeds use the nocookie version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('oembed_result', 'youtubeEmbedNocookieFilter', 10, 3); | |
function youtubeEmbedNocookieFilter(string $data, string $url, array $args) | |
{ | |
return str_replace('src="https://www.youtube.com/embed', 'src="https://www.youtube-nocookie.com/embed', $data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Space Force Edition 🛰️
@rosswintle