2click Embeds
wordpress plugin for replacing 3rd party embeds inside content with a placeholder
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/ddotsch/2click-embeds/archive/refs/heads/main.zipTwo Click Embeds
Descripton:
Privacy-friendly Embeds of 3rd Party Content (YouTube, Vimeo, SoundCloud, Twitter/X, TikTok, Facebook) with a 2-click placeholder.
Installation
- Copy the plugin-folder into your
wp-content/pluginsdirectory - Log into Wordpress → Plugins → activate „Two Click Embeds“
- Optional: add your own provider with the
two_click_embeds_providersfilter and/or add your own Provider_Handler's
Features
- Replaces 3rd party embeds with a placeholder
- placeholder with text and button to confirm
- user can later revoke the consent with an additonal link
- currently supports different providers (YouTube, Vimeo, SoundCloud, Twitter/X, TikTok, Facebook)
- specific handlers based on provider
- can be extended via
Provider_Handler_Factoryand a filter
Example: add provider with a filter
add_filter('two_click_embeds_providers', function($providers){
$providers['myprovider'] = [
'slug' => 'myprovider',
'label' => 'MyProvider',
'xpath' => '//iframe[contains(@src,"myprovider.com")]',
'text' => 'Loading this content sends data to "myprovider.com"',
'handler' => MyProvider_Handler::class,
];
return $providers;
});
Developer Notes
- PHP 7.4+ kompatibel
- Provider registered as Array in class-embed-providers.php, the renderer uses the Provider_Definition class
- main logic: Embed_Renderer (DOM-Manipulation)