Use cookie-less domain for YouTube embeds in WordPress

· Ricky Lee
Use cookie-less domain for YouTube embeds in WordPress

European Union’s General Data Protection Regulation (GDPR) takes effect on May 25, 2018 and organizations must take steps to block cookies or other personally identifiable information before user consent.

YouTube embed iframe by default loads in numerous user tracking cookies. YouTube does offer a cookie-less domain at youtube-nocookie.com

The filter below can be added to WordPress theme or plugin to modify embeds to use this cookie-free domain.