Any way to use a custom Parameter for youtube embed without using an iframe?

No need for a plugin, You can simply use the Oembed class’s oembed_result filter hook

like this:

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&showinfo=0" frameborder="0" allowfullscreen></iframe>';
    }
    return $html;
}
add_filter('oembed_result','Oembed_youtube_no_title',10,3);

so just paste this code in your theme’s functions.php file, setup the width and height at the settings >> media panel and you should be just fine with simply pasting the youtube’s video url in the post.

Leave a Comment