I run a small site based on wp with user generated content. Users often submit youtube links. And then wordpress automatically converts these links to videos which is unwanted in our case. I need to override this automatic behavior so that the submitted youtube links remains in plain text urls
?
I found out that I could remove the oembed provider itself with something like wp_oembed_remove_provider('http://www.youtube.com/oembed')
but I am stumped at how do I use this in my case where $content
is the string that contains the url as well as the submitted post content ? The codex page doesnot says much about it. Could someone give me an example of how this can be done.
In other words I need the oEmbed to skip any youtube link/s in content. Also please let me know if there is a better/more efficient way of solving this.
2 Answers
disable the oembed like below in functions.php :
remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
Thanks!