Hello,
I’m trying to remove embedding videos from youtube but I can’t do it. I am trying to remove youtube using the instructions
https://codex.wordpress.org/Function_Reference/wp_oembed_remove_providerbut youtube videos are still being embedded. How to do it.
Hi Rav,
Please share the complete code. It could be related to either what values you are passing or the hook you are using.Regards
BrajeshHi @Brajesh Singh
I tried the possibilities that I found on the web:
wp_oembed_remove_provider ( ‘#http: // (www \.)? YouTube \ .com / watch. * and #’);
wp_oembed_remove_provider ( ‘#https: // (www \.)? YouTube \ .com / watch. * and #’);
wp_oembed_remove_provider ( ‘#http: // youtu \ .be /.*# I’);
wp_oembed_remove_provider ( ‘#https: // youtu \ .be /.*# I’);Unfortunately it doesn’t work. Now, however, another question came to my mind.
Can you change the embedding to display only image instead of video?
Even for links from YouTube?Hi,
Please give a try to thisadd_action( 'plugins_loaded', function () { // remove youtube support. wp_oembed_remove_provider( '#https?://((m|www)\.)?youtube\.com/watch.*#i' ); wp_oembed_remove_provider( '#https?://youtu\.be/.*#i' ); } );
It should most probably work.
Regards
Brajesh
You must be logged in to reply to this topic.