Advanced Custom Fields oembed only outputs YouTube URL
Having the exact same problem as @Hjalmar on Advanced Custom Fields, but still no fix. Only the URL text displays.
Tried the original ACF oembed option:
div class="embed-container"
?php echo get_field('video_embedd'); ?
/div
No luck.
Placed the YouTube embed URL in the ACF text field and outputting it into an HTML iframe:
?php
$videoEmbeddPlease = get_field('video_embedd');
if (!empty($videoEmbeddPlease)): ?
iframe width="560" height="315" src="?php echo $videoEmbeddPlease?" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen/iframe
?php endif ?
No luck.
Even tried the Advanced ACF example:
?php
// get iframe HTML
$iframe = get_field('video_embedd');
// use preg_match to find iframe src
preg_match('/src="(.+?)"/', $iframe, $matches);
$src = $matches[1];
// add extra params to iframe src
$params = array(
'controls' = 0,
'hd' = 1,
'autohide' = 1
);
$new_src = add_query_arg($params, $src);
$iframe = str_replace($src, $new_src, $iframe);
// add extra attributes to iframe html
$attributes = 'frameborder="0"';
$iframe = str_replace('/iframe', ' ' . $attributes . '/iframe', $iframe);
// echo $iframe
echo $iframe;
?
Even tried the WYSIWYG option.
?php the_field('video_embedd'); ?
Still! No embedded video display, just the YouTube URL text on the screen.
Any help would be incredible.
Thank you!
Topic advanced-custom-fields oembed Wordpress
Category Web