Is there a way to access data of core/embed in oembed filters?
-
Hello,
I want to add a new attribute to the core/embed block for a preview image (privacy matters).
That’s working fine, a little excerpt from my code:
if (name == "core/embed") { settings.attributes = Object.assign(settings.attributes, { previewImage: { type: "string" } }); } }
In the oembed filter I replace the embed with custom HTML. There I want to include the previewImage from the embed block. Can I access a block attribute from the oembed filter?
function edit_oembed_html($html, $url, $attr, $post_ID) { // Get thumbnail from block attribute 'previewImage' // $thumbnail = this->embed->previewImage; PSEUDO CODE // Build HTML template $html = ' <div class="v4core_embed_blocker"> <img src="'. $thumbnail .'" alt="'. $name .'" /> </div>'; // Return it return $html; } add_filter( 'embed_oembed_html', 'edit_oembed_html', 10, 4);
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Is there a way to access data of core/embed in oembed filters?’ is closed to new replies.