[wp-hackers] best way to remove oembed provider
Chris McCoy
chris at lod.com
Wed Feb 5 14:45:52 UTC 2014
Ya my example is for only youtube videos.
I eneded up using the 1st one, as I saw the other one was a wrapper.
On 2/5/2014, 6:36 AM, "Pascal Birchler" <pascal.birchler at gmail.com> wrote:
>Since wp_oembed_remove_provider() is basically a wrapper function for the
>first example, my choice would be this function.
>
>There was a similar question on WordPress SE (
>http://stackoverflow.com/questions/19466374/filtering-wordpress-oembed-pro
>vider-list)
>where the filter was recommended because the user wanted to only allow a
>couple of providers.
>
>
>2014-02-01 Chris McCoy <chris at lod.com>:
>
>> 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' );
>>
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>_______________________________________________
>wp-hackers mailing list
>wp-hackers at lists.automattic.com
>http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list