0

Having the exact same problem as @Hjalmar on Advanced Custom Fields, but still no fix. Only the URL text displays.

Front End oembed output

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!

  • You check ACF Support? – RiddleMeThis Feb 12 at 19:49
  • @RiddleMeThis I have not. Probably should, shouldn't I? Can I just link to this post? – Luke Feb 20 at 20:02
0

Such happens when video is not publicly accessible. In my case the video was simply removed from YouTube by their author and ACF's oEmbed module was unable to get metadata to properly display video.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.