Although I produce very little for YouTube myself, I find other people's videos very helpful. Even with Mac or iPhone problems, a video is sometimes more descriptive than writing a lot of words. Incidentally, that also shows that macOS Catalina book by Anton Ochsenkühn, which relies on many explanatory videos and thus makes macOS functions much clearer than many books that only consist of a text mess with isolated screenshots.
If you now embed Youtube videos in your Wordpress blog by just copying the video URL into the text, Wordpress replaces it with an iframe embed code on output, which unfortunately means that cookies from Youtube are blocked in the browser of the user can be set. However, given the current EU cookie situation, this is legally critical and should be avoided.
Chapter in this post:
It is important to know that turning off cookies does not mean that YouTube can collect data about the user. Even if you use the nocookie variant of the embedding code from YouTube, by including the video in your own blog it is still possible for YouTube to collect information about the article the moment the user calls up the article. The safe way to prevent this is the Borlabs Cookie Plugin, which I will mention shortly. This requires user approval before the embed code is run.
Note: I am not a lawyer and this is also not legal advice. ;-)
I chose the paid solution on my blog and I chose the Borlabs cookie plugin for WordPress installed and configured. The plug-in requires user approval before the videos can be played. At 39 euros per year, the service is okay for me, as I also earn money with my blog, but if you have little financial means and only maintain an informative blog that does not generate anything, then the second alternative may be the right choice.
On the other hand, those who use Google Analytics and other cookie-friendly services should perhaps consider whether investing in Borlabs Cookie is a good idea. With the plugin, many services are already preconfigured and only need to be activated. This is much easier than integrating them in a dsgvo-compliant way via detours.
Alternative 2: change Youtube embed code
Youtube has had an option for years to prevent cookies from being set when accessing the embed code for a video. Unfortunately, Wordpress does not use this option by default and instead always uses the YouTube code that uses cookies. I hope this will be changed in core WordPress soon, but for now it's up to you.
If you want to stop Wordpress from doing this, you have to change the funktions.php file, which can be found in every theme directory of a Wordpress installation. The path is this one:
/WORDPRESS/wp-content/themes/NAME-DES-THEMES/functions.php
You open this file (or create it if it does not yet exist) and add the following code (I found the code somewhere, but unfortunately I did not note the source):
add_filter ('embed_oembed_html', 'youtube_nocookie_loesung', 10, 4); function youtube_nocookie_solution ($ original, $ url, $ attr, $ post_ID) {$ html = str_replace ("youtube.com", "youtube-nocookie.com", $ original); $ html = str_replace ("feature = oembed", "feature = oembed & showinfo = 0", $ html); return $ html; }
If there is already code in functions.php, you can add it below. If the file is still empty, you have to “
After pasting the code, the Youtube URLs will then be replaced with the domain “youtube-nocookie.com”, which does not set cookies.
Important: Change your own iFrame codes manually!
Anyone who has used the YouTube embed code in the source text of the blog article here and there should change it manually and switch to the youtube-nocookie.com domain. The script mentioned above does not change their occurrence, but only intervenes if the pure URL to the YouTube video has been incorporated into the posts.
Tip: change functions.php with plugin
If tinkering in the PHP file is too dangerous for you, you can also use the plugin "Code Snippets”, which allows you to inject arbitrary code into Wordpress, as functions.php would do – except that the code is saved in the database and is not lost after a theme update. I would prefer this route as a beginner.
Related Articles
Jens has been running the blog since 2012. He acts as Sir Apfelot for his readers and helps them with technical problems. In his spare time he rides electric unicycles, takes photos (preferably with the iPhone, of course), climbs around in the Hessian mountains or hikes with the family. His articles deal with Apple products, news from the world of drones or solutions to current bugs.