[wp-hackers] best way to remove oembed provider

Chris McCoy chris at lod.com
Sat Feb 1 20:36:22 UTC 2014


Which way is the best, to use remove provider, or unset the value through
the oembed_providers filter?

function remove_youtube_oembed( $providers ) {
        unset($providers['#https?://(www\.)?youtube\.com/watch.*#i']);
        return $providers;
}

add_filter( 'oembed_providers', 'remove_youtube_oembed' , 10, 1);

function remove_embeds() {
        wp_oembed_remove_provider(
'#https?://(www\.)?youtube\.com/watch.*#i' );
}

add_action( 'init', 'remove_embeds' );





More information about the wp-hackers mailing list