Hi there,
it doesn’t seem to be a problem with this plugin in particular. I just installed it alongside Embed Privacy in my local environment and it just works, a YouTube video is being blocked properly.
It’s more likely another plugin or a theme issue. Can you give me a list of plugins and the used theme, please?
Best regards,
Matthias
Thread Starter
Abid
(@hussain76)
Thanks for your quick response.
We’re using a self developed theme.
Here you find a list of all plugins
Ads.txt Manager
Ajax Load More
All in One SEO
Antispam Bee
Broken Link Checker
Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics
Duplicator
Easy Liveblogs
Embed Privacy
Genesis Custom Blocks
GN Publisher
Instant Images
IONOS Assistant
IONOS Help
IONOS Journey
IONOS Login
IONOS Navigation
IONOS Performance
IONOS Security
Jetpack
Live Blog WP
Liveticker (by stklcode)
Loco Translate
Mobile Detect
Multiple Post Thumbnails
PublishPress Authors
Real Cookie Banner (Free)
Simple Local Avatars
Statify
UpdraftPlus – Sichern/Wiederherstellen
WPCode Lite
wpDiscuz
WPForms Lite
XML Sitemap & Google News
Yoast SEO
Okay, that’s many. Can you create a staging site (or maybe you already have one), disable all plugins except for Embed Privacy and the news ticker and check whether the problem persists? If no, please enable one plugin after another and check if the problem occurs again.
Thread Starter
Abid
(@hussain76)
Just a follow-up: I noticed when you embed in the same post an additional tweet outside of the ticker the assets are included. The overlay inside the ticker is displayed but clicking the opt-in checkbox has no effect. See the example page I provided in advance to view the result.
So the question is: what conditional logic controls if the assets are included and why is the checkbox not working? May you have any guess where in the php code I could start to debug?
Unfortunately in a production environment enabling on plugin after another seems not to be a realistic option …
-
This reply was modified 2 years, 5 months ago by
Abid.
That’s why I ask you to create a staging environment first. Otherwise, it’s simply not reproducible for me in my environment.
There’s no real conditional logic. Every time an embed is detected and replaced, Embed_Privacy::$is_embeds is set to true:
https://github.com/epiphyt/embed-privacy/blob/main/inc/class-embed-privacy.php#L1182
Then, this variable is later checked and the assets are printed:
https://github.com/epiphyt/embed-privacy/blob/main/inc/class-embed-privacy.php#L1759-L1761
Thread Starter
Abid
(@hussain76)
In my staging environment I have now the situation that embed privacy assets are never included (even in posts without the ticker plugin). So it doesn’t work at all currently.
Please note that I disabling all plugins didn’t change anything about this issue.
Except from that there are no issues in the staging environment.
I put some error_log outputs in the code: print_assets is called. wp_enqueue_script('embed-privacy') is called either. But for any reason the assets aren’t included.
Only thing I noticed is that every time a post is opened in the browser a warning appears in the logs:
[05-Dec-2023 16:16:48 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'epiphyt\Embed_Privacy\Embed_Privacy' does not have a method '' in /Applications/MAMP/htdocs/apollo-news/wp-includes/class-wp-hook.php on line 324
-
This reply was modified 2 years, 5 months ago by
Abid.
Thread Starter
Abid
(@hussain76)
Please ignore my last post. I accidentally made a change in class-embed-privacy.php which caused the issue.
Since you have a staging environment now, can you please disable all other plugins and try if the problem persists.
To me it highly sounds like a problem with a plugin or theme that tries to “optimize” loaded assets, but seems to fail here. If the function gets called, the assets are registered in WordPress. Everything else is up to WordPress or other plugins that hook into the script/style queue.
Thread Starter
Abid
(@hussain76)
I managed to figure out what the problem was.
Embed Privacy (EP) includes the assets if the post’s content matches one of the configured regexes (e.g. twitter\.com).
The reason why you couldn’t reproduce the issue in your test page is likely that there’s matching content outside the ticker.
The ticker plugin loads content via Ajax. Therefore EP doesn’t match anything inside the ticker content.
As a workaround I inserted a content filter which places some html comments <!-- twitter.com -->, etc. in the content so that EP has a match and includes the assets. The overlays are now displayed correctly.
But now I encounter another issue: the event listeners for the checkboxes do not work as they are initialized on DOMContentLoaded. This doesn’t work if the content’s are inserted via Ajax.
Is there any possibility to make the checkboxes work for async content?
-
This reply was modified 2 years, 5 months ago by
Abid.
-
This reply was modified 2 years, 5 months ago by
Abid.
-
This reply was modified 2 years, 5 months ago by
Abid.
Thread Starter
Abid
(@hussain76)
To ask the last question in another way: is EP capable in handling async content? If no, is there a way to disable it for selected embeds?
Thread Starter
Abid
(@hussain76)
… or is there a way to apply a filter so that EP is not applied to specific posts?
Embed Privacy is currently not designed to properly work with Ajax content and it’s currently not planned to implement it.