youtube video blocking with acf repeater field
-
Hi there.
I use videos inside an acf repeater field (for an accordion with wysiwyg-field) and it doesn’t work as expected – the layout is broken and the javascript functions are not working. when I insert the line add_filter( ‘acf_the_content’, [ $this, ‘replace_embeds’ ], 10, 2 ); everything works like a charm. Thanks for your help.
Regards, Rayaan
-
I can confirm this is still broken.
Also, while adding the filter to https://github.com/epiphyt/embed-privacy/blob/main/inc/class-embed-privacy.php#L272
does help initially if you have an embed within an acf editor field, i’m experiencing the strange behaviour that the previously shown YT-preview image gets deleted after I save the post.
These were my steps:- Have a post with an embed within an ACF WYSIWYG Editor
- Install Embed Privacy 1.6.5
- Enable Javascript detection and preview images
- View Post in frontend (Embed Layout broken and loading is not working, though YT Preview image is shown in Background!)
- add above mentioned filter in class-embed-privacy.php L272
- View Post again: Everything looks and works as it should
- Save/Update Post (no actual changes made)
- Preview image is gone (deleted from post_meta), so a black preview screen remains.
Hope this helps!
Any chance we can get this working?
How exactly is your ACF field configured?
In my specific case it is is a WYSIWYG-Editor Field with:
Tabs: Visual & Text, Toolbar: Full, Show Button for Media Upload
And I’m using the Classic Editor.Just a normal ACF repeater field with a WYSIWYG editor subfield for the accordeon content and a text subfield for the accordeon title. WYSIWYG configuration:
– tabs: visual & text
– toolbar: full
– upload-button: showRegards, Rayaan
-
This reply was modified 3 years, 1 month ago by
bzweic.
Can you please re-check with the latest version 1.7.0?
It seems to work nicely for new embeds on my sites! Thanks for the fix!
One Question though: It doesn’t seem to update existing videos that didn’t have been working before.
Those videos had post meta data like “_oembed_{hash}” with an empty value.
I was able to manually correct this by:
1. removing the video link from the ACF text-editor field
2. removing the _oembed_{hash} post meta entry (via Post Meta Data Manager)
3. saving the post
4. Entering video Link back again
5. saving the post (hereby creating a correct _oembed_{hash} post meta entry)
6. saving the post again (hereby creating/attaching the sideloaded thumbnail)
This is quite the extensive action to do on all posts with an embedded video.
Do you think you might be able to add a check & refresh function for these cases?
Or maybe an extra helper function to run?I’m glad it works now.
Regarding your metadata problem: This is no result of Embed Privacy being not functional since it doesn’t do anything while storing the metadata. It’s only active in the output. So if there are missing metadata for your embeds, the problem comes from something different.
Embed Privacy is further not in charge of changing something regarding stored metadata, even not for embed metadata. This would be roughly outside of its scope so that I will not implement it. I hope you understand.
The problem is still the same as before 🙁 without the fix
add_filter( 'acf_the_content', [ $this, 'replace_embeds' ], 10, 2 );in line 273 of file class-embed-privacy.php it’s not working (css styling & js-functions to allow embeds) and after second saving of the acf-field thumbnail is missing.
I now checked myself with the given information (a repeater field with a sub field as WYSIWYG editor). When I fill it with a YouTube URL and output it, the embed is replaced properly.
I’m not sure why only there, but I also had to reapply the above fix on one of my sites, otherwise no javascript (and probably css) would be loaded.
This occured after an update to all the latest versions of WP, ACF Pro and Embed Privacy. (PHP 8.0)
Reverting to Embed Privacy 1.7.1 or 1.7.0 did not fix the behaviour.
Neither did Reverting to ACF 6.0.7.
In my case the WYSIWYG Field is nested within a Group Field.Can you please export the field group and paste it into an issue here:
https://github.com/epiphyt/embed-privacy/issues/new?assignees=&labels=&projects=&template=bug-report.ymlsame here with wysiwyg as a subfield in a flexible content layout. (plugin version 1.7.2, ACF 6.0.7, WP 6.0.7 in “classic mode”).
choose a slight variation of fixes proposed above (in functions.php) that makes things work.
if ( class_exists( 'epiphyt\Embed_Privacy\Embed_Privacy' ) ) { add_filter( 'acf_the_content', function($content) { return epiphyt\Embed_Privacy\Embed_Privacy::get_instance()->replace_embeds($content); }, 10, 2 ); }I’m aware of it and will take a look into it as soon as it’s on top of my list. 🙂
The topic ‘youtube video blocking with acf repeater field’ is closed to new replies.