so, when you were using
$video_url = get_sub_field('video', false, false);
the second false in this function call tells ACF not to format the value, so it’s returning just the URL.
Now you are getting the repeater (flex field) using
$content_blocks = get_field('content_blocks', $project->ID);
and ACF is formatting the value of the oEmbed field so instead of returning the URL it’s returning the full iFrame, or at least is should be because that’s why I’m getting when I test this.
So, here are your choices as I see them. Do what you doing and get unformulated values for every sub field
$content_blocks = get_field('content_blocks', $project->ID, false);
This will mean that you’ll need to manually format all of the fields, for example the image field will only return the image ID and you’ll need to use WP function to get other image information.
The other choice is to go back to using the ACF have_rows loop and figure out how to correct whatever error that was giving you.
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!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.— Advanced Custom Fields (@wp_acf) January 6, 2023
© 2023 Advanced Custom Fields.