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!

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

2 Answers 2

1

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.

0

It's also possible that google is blocking the api request to fetch the embed data.

ACF uses the wp_oembed_get function which goes off and grabs metadata from Youtube before displaying the iframe.

Sometimes google may block your server or network if it thinks you have been making too many requests. Google will return the confirm you're not a robot page with the message

"Our systems have detected unusual traffic from your computer network"

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.