Home Forums General Issues Use get_sub_field outside have_rows Reply To: Use get_sub_field outside have_rows

  • 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.