Dynamically Embed Youtube Video in ACF Field in Gutenberg

, ,
YouTube video

Written By

Jonathan Jernigan

This video will teach you how to show a YouTube video URL inside of an ACF field on the frontend of your Gutenberg site, without having to manually copy and paste the links into a video component.

In my case, I’m using GeneratePress and GenerateBlocks and wanted the URL to be dynamically shown on the front end.


function yt_video_shortcode() { 
    $myfield = get_field('video_url');
    return $myfield;
add_shortcode( 'ytvideo', 'yt_video_shortcode' );

Signup for the most inconsistent newsletter this side of the Mississippi

Delivered on a regular-as-I-can basis, I'll share interesting blog posts, announcements, and other pertinent information. I hate garbage emails as much as you and promise not to make it worse.

  • This field is for validation purposes and should be left unchanged.