Embed Youtube Into Your WordPress Theme

The way WordPress handles Youtube embeds is awesome - just copy-and-paste the link into the editor.  
Unfortunately, when echoing custom fields in a theme, it isn't that easy.  
Thanks to Convoy for this fix:

_e( wp_oembed_get( get_field( 'youtube_link' ) ) ); 

NOTE: My example, uses Advanced Custom Fields' "get_field" function. You could replace get_field( 'youtube_link' ) with get_post_meta().

Posted in

Toby Cryns

Toby Cryns is a freelance CTO, expert WordPress consultant, and teacher.

He offers free advice to improve your freelance biz.

He also publishes small droppings every now and then to twitter.com/tobycryns and twitter.com/themightymo

Follow Toby's contributions on Github and WP.org.