Remove Related Videos From WordPress oEmbed Youtube Videos

By 11th March 2015Blog

If you’re embedding videos into WordPress, possibly as a post, you may sometimes want to add parameters to the code to overwrite the oEmbed default behaviour of WordPress.

This can be achieved by creating your own plugin or adding this snippet to your functions.php file. This example removes the related videos at the end of the video (rel=0) although other usual parameters can also be applied, such as autoplay, showinfo etc.

function Oembed_youtube_no_title($html,$url,$args){
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);
if (isset($id['v'])) {
return '<iframe width="'.$args['width'].'" height="'.$args['height'].'" src="http://www.youtube.com/embed/'.$id['v'].'?rel=0" frameborder="0" allowfullscreen></iframe>';
return $html;


I'm a Wordpress web developer and website designer based in Cheshire, UK. I specialise in Wordpress, Responsive design and website conversion. | Twitter | Linkedin


Leave a Reply