Remove Related Videos From WordPress oEmbed Youtube Videos

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="'.$id['v'].'?rel=0" frameborder="0" allowfullscreen></iframe>';
return $html;

Useful post? Share it

3 comments on “Remove Related Videos From WordPress oEmbed Youtube Videos

Leave a Reply

Your email address will not be published. Required fields are marked *