Sadly this particular code doesn’t work for vimeo. I stepped through the function and found that it was receiving a 404 error from vimeo (with what the documentation says is an accurate url). I understand that vimeo changed something a while back so it may be outdated. (this being what has prompted this exercise for me as we suddenly lost all our vimeo embeds with ACF 4.)
You’ve sent me in the right direction however.
Also a note to anyone else reading – my markup above doesn’t require the wp_oembed_get() code. I had a mistake in my customfield setup where the oembed field had ‘changed’ to text format.
Correct video code with oembed correctly setup is
$rows = get_field('video'); // get all the rows $first_row = $rows; // get the first row $first_video = $first_row['video_embed']; // get the sub field value echo $first_video;
If anyone has a recent working solution to this then I’m all ears! It’s not as if this is an unusual use case. 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!