Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

youtube_oembed_provider

// Register oEmbed providers
function youtube_oembed_provider() {

	wp_oembed_add_provider( '#https?://(www.)?youtube.com/watch.*#i', 'http://www.youtube.com/oembed/', true );
	wp_oembed_add_provider( '#https?://(www.)?youtube.com/playlist.*#i', 'http://www.youtube.com/oembed/', true );
	wp_oembed_add_provider( '#https?://(www.)?youtu.be/.*#i', 'http://www.youtube.com/oembed/', true );

}

// Hook into the 'init' action
add_action( 'init', 'youtube_oembed_provider' );