Skip to content

Instantly share code, notes, and snippets.

allow_url_fopen = off
<?php wp_oembed_remove_provider( 'http://wordpress.tv/*' ); ?>
<?php wp_oembed_remove_provider( $format ) ?>
<?php
wp_embed_register_handler( 'forbes', '#http://(?:www|video)\.forbes\.com/(?:video/embed/embed\.html|embedvideo/)\?show=([\d]+)&format=frame&height=([\d]+)&width=([\d]+)&video=(.+?)($|&)#i', 'wp_embed_handler_forbes' );
function wp_embed_handler_forbes( $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>',
esc_attr($matches[1]),
esc_attr($matches[2]),
<?php wp_embed_register_handler( $id, $regex, $callback, $priority ); ?>
// Register oEmbed providers
function custom_oembed_provider() {
wp_oembed_add_provider( 'https://example.com/*', 'https://example.com/oembed', false );
wp_oembed_add_provider( 'https://www.your-domain.com/video-*', 'https://www.yourdomain.com/oembed-provider', true );
}
add_action( 'init', 'custom_oembed_provider' );
<?php wp_oembed_add_provider( $format, $provider, $regex ); ?>
[embed width="560" height="315"]https://youtu.be/WQE2nCaihNQ[/embed]
Check out the video below:
https://youtu.be/WQE2nCaihNQ
What did you think of that video?
<embed height="560" width="315" src="https://youtu.be/WQE2nCaihNQ" />