1

I used this function for other video hosts, but for some reason, now it's not working. This is the direct and embed code of the video

https://vidoza.net/r2jeim68kuq6.html

<IFRAME SRC="https://vidoza.net/embed-r2jeim68kuq6.html" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=640 HEIGHT=360 allowfullscreen></IFRAME>

and this is my registration function.

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


function vidoza_embed_handler( $matches, $attr, $url, $rawattr )
{
    $embed = sprintf( 
        '<IFRAME SRC="https://vidoza.net/embed-%1$s" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=640 HEIGHT=360 allowfullscreen></IFRAME>',
        esc_attr( $matches[1] )
    );
    return apply_filters( 'vidoza_embed_handler', $embed, $matches, $attr, $url, $rawattr );
}

I am not able to get it to work.

0

1 Answer 1

2

You are trying to match the r2jeim68kuq6.html part, but you're not allowing dots in your regex pattern here:

'#https://vidoza\.net/([a-zA-Z0-9_-]+)$#i'

You can try e.g. (removing the A-Z too because of the case-insensitive i search):

'#https://vidoza\.net/([a-z0-9_-]+)\.html$#i'

if .html is a standard extension and where you also adjust the iframe source to:

src="https://vidoza.net/embed-%1$s.html" 

Hope it helps!

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.