This plugin replaces YouTube embeds (via shortcode) with a privacy-friendly click-to-load placeholder. The actual YouTube embed is only loaded after an explicit user click (optionally using youtube-nocookie.com).
- Click-to-load instead of immediate YouTube embed (no requests to YouTube until clicked)
- Optional
youtube-nocookie.comdomain - Custom notice heading + optional additional text
- Customizable button label
- Optional background image (preview) inside the placeholder
- Configurable placeholder height and overlay strength
- CSS/JS are only injected when the current page actually contains a video wrapper
- Bludit 3.x (tested with 3.14.1)
- Copy the folder
youtube-click-to-loadintobl-plugins/. - In the backend go to
Settings->Pluginsand activate the plugin.
- Direct link:
https://YOUR-DOMAIN/admin/configure-plugin/pluginYoutubeClickToLoad - The plugin adds a link to the admin sidebar for quick access to the settings.
| Field | Description |
|---|---|
enablePages |
Enable on pages |
enablePosts |
Enable on posts/home |
useNoCookieDomain |
Uses youtube-nocookie.com instead of youtube.com |
placeholderText |
Heading above the notice text in the placeholder |
belowButtonText |
Additional text (optional) in the placeholder |
buttonText |
Label of the load button |
wrapperClass |
Additional CSS class(es) for the wrapper (base class is always applied) |
backgroundImage |
Optional background image for the placeholder (<img> inside the wrapper) |
wrapperHeight |
Placeholder height in pixels |
overlayStrength |
Overlay strength from 0 to 1 |
Note: The additional text belowButtonText is currently rendered below the heading and above the button.
In the content of a page / post:
[youtube VIDEO_ID][youtube id=VIDEO_ID][youtube id="VIDEO_ID"]
Example:
[youtube dQw4w9WgXcQ]
beforeSiteLoad()searches the rendered content for the shortcode and replaces it with a wrapper.- The wrapper includes data attributes such as
data-youtube-id,data-youtube-embed-base,data-yt-height,data-yt-overlay. siteHead()injects assets only when needed (when wrappers were found):css/youtube-click-to-load.cssjs/youtube-click-to-load.js
- On button click, the script creates an
<iframe>and replaces the placeholder content.
Base classes:
.yt-privacy-wrapper(always applied).yt-privacy-inner,.yt-privacy-text,.yt-privacy-note,.yt-privacy-button,.yt-privacy-iframe.yt-privacy-bg(only whenbackgroundImageis set)
CSS variables (set by JS from data-yt-*):
--yt-wrapper-height(e.g.400px)--yt-overlay-strength(e.g.0.55)
Example (theme CSS):
.yt-privacy-wrapper {
border-radius: 12px;
}
.yt-privacy-button {
background: #111;
}
.yt-privacy-button:hover {
background: #333;
}- Without a click, no YouTube embeds are loaded; therefore there are typically no YouTube requests / third-party cookies triggered by the embed.
- With a click, the video is loaded as an embed. Using
youtube-nocookie.comenables the "enhanced privacy mode", but it does not replace legal review.
placeholderTextandbelowButtonTextare processed via a decode helper during rendering. This can allow HTML output if you store HTML in these fields.- In most setups only admins can access plugin settings; still, only use trusted code/HTML in these fields.
.
├─ plugin.php
├─ metadata.json
├─ languages/
│ ├─ de_DE.json
│ └─ en.json
├─ view/
│ └─ dashboard.php
├─ css/
│ └─ youtube-click-to-load.css
└─ js/
└─ youtube-click-to-load.js
MIT License (see metadata.json and the license text in the class PHPDoc in plugin.php).


