Tag Info

New answers tagged


Make a custom plugin for your site, put this code in it. add_filter('oembed_dataparse','oembed_youtube_add_wrapper',10,3); function oembed_youtube_add_wrapper($return, $data, $url) { if ($data->provider_name == 'YouTube') { return "<div class='whatever'>{$return}</div>"; } else { return $return; } }


Something like this should do the trick and force rel=0 for all YouTube oembed results. add_filter('oembed_dataparse','youtube_force_rel',10,3); function youtube_force_rel($return, $data, $url) { if ($data->provider_name == 'YouTube') { return str_replace('feature=oembed', 'feature=oembed&#038;rel=0', $return); } else { return ...


Here is the YouTube shortcode. // youtube shortcode. function sc_youtube_single( $att, $content = null ) { return '<iframe width="640" height="480" src="' . do_shortcode( $content ) . '?rel=0" frameborder="0" allowfullscreen></iframe>'; } add_shortcode( 'youtube', 'sc_youtube_single' ); And you can add videos in your content like this. ...


I have tried the answer from the @Rarst, but in fact it is not very stable solution to the problem. If you try to var_dump the $meta var above, you will notice that there is at least one another meta field _oembed_time_xxxxxxxxxxxx which is probably for cache busting. And also, when I removed the oEmbed link from the content of the post, the cached eEmbed ...

Top 50 recent answers are included