Thursday, June 9, 2022
HomeWordPress Developmentembed by way of wp_embed_register_handler solely works in front-end

embed by way of wp_embed_register_handler solely works in front-end


I am attempting to create a small plugin that may permit to embed movies from our Kaltura occasion. As we’re utilizing Kaltura Utility Framework (KAF) regular oEmbed is just not working :(.
I’ve the next code:

add_action('plugins_loaded', 
    perform() {
        wp_embed_register_handler(
            'kalturaplay',
            '#https://our.kaltura.website/id/([A-Z0-9_]+)#i',
            'kaltura_play_embed_handler',
            100
        );
    }
);

Then I took the iframe embed code and simply added within the id:

perform kaltura_play_embed_handler( $matches, $attr, $url, $rawattr ) {
    $embed = '<iframe src="https://our.kaltura.kaf.server/and/some/additional/stuff?
…
entry_id=' . esc_attr($matches[1]) …

width="608" peak="402" frameborder="0" permit="autoplay *; fullscreen *; encrypted-media *"></iframe>';  
    return $embed;
} 

This works completely on the entrance finish, however on the backend nothing reveals up. When inspecting the HTML-code within the backend I can see that if I examine to a working embed (like YouTube) I’ve within the working instance one thing like

iframe
   physique
     div
       iframe (with the true embed)

However my non-working code seems like

iframe
   physique
      div

and right here the div is empty?! So no second iframe! I.e. it seams like WordPress cannot load the iframe into the iframe as wanted on the backend however on the entrance finish when it solely wants the internal iframe it really works.

Any ideas?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments