Skip to content

Instantly share code, notes, and snippets.

@GiriAakula
Last active April 26, 2022 05:19
Show Gist options
  • Save GiriAakula/4481b722436683368b8464fc2a6603a7 to your computer and use it in GitHub Desktop.
Save GiriAakula/4481b722436683368b8464fc2a6603a7 to your computer and use it in GitHub Desktop.
Vidgyor wordpress whitelist
In the server go to the wordpress path.. in most systems it is
/var/www/wordpress/wp-includes/embed.php
In the above file add this
wp_embed_register_handler( 'vidgyor', '#https://static\.vidgyor\.com/player/vod/html/(.+?)\.html\?videoId=(.+?)&cmsAccountId=(.+?)&masterProfileId=(.+?)($|&)#i', 'wp_embed_handler_vidgyor' );
function wp_embed_handler_vidgyor( $matches, $attr, $url, $rawattr ) {
$embed = sprintf(
'<iframe src="http://www.forbes.com/video/embed/embed.html?show=%1$s&format=frame&height=%2$s&width=%3$s&video=%4$s&mode=render" width="%3$spx" height="%2$spx" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe>',
'<iframe id="vidgyor_iframe"
src="https://static.vidgyor.com/player/vod/html/indexv2.html?videoId=%1$s&cmsAccountId=%2$s&masterProfileId=%3$s"
frameborder="0" width="640px" title="YouTube video player" height="360px" style="min-width: 200px;" allowfullscreen allow="autoplay;"
mozAllowFullScreen webkitAllowFullScreen scrolling="no">',
esc_attr($matches[1]),
esc_attr($matches[2]),
esc_attr($matches[3]),
esc_attr($matches[4])
);
return apply_filters( 'embed_vidgyor', $embed, $matches, $attr, $url, $rawattr );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment