How add class youtube and type/html to oembed code?

You can try this:

add_filter( 'embed_oembed_html', 'custom_youtube_oembed' );
function custom_youtube_oembed( $code ){
    if( stripos( $code, 'youtube.com' ) !== FALSE && stripos( $code, 'iframe' ) !== FALSE )
        $code = str_replace( '<iframe', '<iframe class="youtube-player" type="text/html" ', $code );

    return $code;
}

to target the YouTube oembed HTML output.

When I embed this YouTube link (Kraftwerk) into the post content

http://youtu.be/VXa9tXcMhXQ

I get this HTML output:

<iframe class="youtube-player" type="text/html"  
        width="625" height="469" 
        src="http://www.youtube.com/embed/VXa9tXcMhXQ?feature=oembed" 
        frameborder="0" allowfullscreen></iframe>

with the above filter.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)