1

I was trying to embed a vimeo link into a site using ACF custom fields and I am not getting anything in the front end but just a blank space as shown below.

enter image description here

I tried multiple approaches including a vimeo iframe as well as just pasting the link but nothing seems to work.

The embed code is given below

<h3>Watch a Video</h3>
<iframe src="//player.vimeo.com/video/75791532?title=0&amp;byline=0&amp;portrait=0" width="500" height="375" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

I checked multiple sites and all of them say I should be able to embed using the iframe or just the link, so I am not sure whats happening here.

4

If the custom field contains just the URL you can achieve this using wp_oembed_get

$video_url = 'https://vimeo.com/75791532';
$video = wp_oembed_get( $video_url );
echo $video;

If the custom field contains other content as well something like this should work.

$content = '<p>Check out hte latest vid!</p>
     https://vimeo.com/75791532';

$content = apply_filters('the_content', $content);
echo $content;

the_content filter automatically applies the oembed filter.

  • Sorry but it contains content too and not just the URL. – Mervin Johnsingh Feb 24 '15 at 11:55
  • I've edited my answer. – Duane Feb 24 '15 at 14:18

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