Remove Cookies from YouTube Videos in WordPress

Remove Cookies from YouTube Videos in WordPress

Introduction

Embedding YouTube videos in WordPress websites is a common practice, but the default YouTube embed code loads tracking cookies, which may raise privacy concerns, especially in regions like the EU where GDPR compliance is required. By using YouTube’s “no-cookie” embed option (nocookie domain), you can prevent unnecessary tracking cookies from being loaded, enhancing user privacy. This article provides a detailed guide on how to achieve this in WordPress, including manual methods and plugin-based solutions.

Open the YouTube video, click the “Share” button, and select the “Embed” option.

Copy the provided embed code, which typically looks like: https://www.youtube.com/embed/VIDEO_ID

Replace www.youtube.com in the embed code with www.youtube-nocookie.com.

Example of modified code: https://www.youtube-nocookie.com/embed/VIDEO_ID

Log in to the WordPress dashboard and open the page or post where you want to embed the video.

Use the “Custom HTML” block (or the “Text” mode in the Classic Editor) to paste the modified embed code.

Save and preview the page to confirm the video displays correctly without loading tracking cookies.

Notes

Ensure other parameters in the embed code (e.g., width and height) suit your website’s design.

Using youtube-nocookie.com does not affect video playback quality or functionality; it only removes tracking cookies.

Conclusion

By manually modifying the embed code or using a plugin, you can easily implement no-cookie YouTube video embedding in WordPress. This not only enhances user privacy but also helps your website comply with data protection regulations like GDPR. The manual method is ideal for developers who want control over the code, while the plugin method is more suitable for users seeking a streamlined process.

Leave a Reply