Repository navigation
Serve YouTube embeds from youtube-nocookie.com and Vimeo with dnt=1 - #23
Merged
Merged
Conversation
tuwebcumple.es flagged "YouTube videos set cookies before consent". Editors paste normal YouTube/Vimeo links and WordPress stores the regular embed URL; the new PrivacyEmbeds class rewrites those iframes on output (src and lazy-load copies such as WP Rocket's data-lazy-src) to the cookieless modes, so videos stay visible but set no cookies before the visitor decides. Only active while the Cookie Notice is enabled; filter frcn_privacy_enhanced_embeds turns it off. Version 1.0.3-beta.youtube. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The version bump and changelog entry are done once on main when 1.0.3 is released, so the open PRs do not conflict with each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidperezgar
approved these changes
Nov 10, 2026
davidperezgar
approved these changes
Nov 11, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Embedded YouTube videos loaded from
youtube.comas soon as the page opened, so YouTube set cookies before the visitor had accepted or rejected anything.Solution
FrontConsent now rewrites video embeds before the page is sent to the visitor:
youtube.com/embed/…→youtube-nocookie.com/embed/…(YouTube's privacy-enhanced mode, no cookies on load).dnt=1(do not track) toplayer.vimeo.com/video/….Editors keep pasting normal YouTube/Vimeo links; nothing changes in the content. Videos are still visible and playable, they just don't set cookies before consent. Lazy-loaded videos (e.g. WP Rocket) are covered too.
Only active while the Cookie Notice is enabled. Can be turned off with the
frcn_privacy_enhanced_embedsfilter.Tests
New
PrivacyEmbedsTest. PHPUnit, JS tests, phpcs and phpstan pass.Version:
1.0.3-beta.youtube.