0

Good Afternoon, i want to embed this video in my wordpress https://streamtape.com/v/7qDqGjlQe4UA9MR/Soul_Land_03_VOSTFR.mp4 Embed code <iframe src="https://streamtape.com/e/7qDqGjlQe4UA9MR/Soul_Land_03_VOSTFR.mp4" width="800" height="600" allowfullscreen allowtransparency allow="autoplay" scrolling="no" frameborder="0"></iframe>

I have tried to paste the following code in my theme function.php file but it doesn't function. I would be very happy to receive your help

add_action( 'init', function()
{        wp_embed_register_handler(
        'streamtape', 
        '#https://streamtape\.com\/v\/([a-zA-Z0-9_-]+)$#i',   
        'streamtape_embed_handler' 
    );
} );


function streamtape_embed_handler( $matches, $attr, $url, $rawattr )
{
    $embed = sprintf( 
        '<IFRAME SRC="https://streamtape.com/e/([a-zA-Z0-9_-]+)$#i" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=800 HEIGHT=600 allowfullscreen></IFRAME>',
        esc_attr( $matches[1] )
    );
    return apply_filters( 'streamtape_embed_handler', $embed, $matches, $attr, $url, $rawattr );
}
2
  • The embed code works fine pasted into a Post or Page. Can you give me more information on why you're trying to embed this through functions rather than just pasting it in a Page or Post? This is a very non-standard way of doing things.
    – Pixelsmith
    Oct 22, 2020 at 0:13
  • I want to autoembed streamtape videos in my wordpress using direct video link
    – Ferréol
    Oct 22, 2020 at 0:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.