Home Forums Front-end Issues Update to 5.11 cloned repeater field returns empty array


Update to 5.11 cloned repeater field returns empty array

  • After updating to 5.11 the output from a cloned repeater get_field changed to:

        [field_5eb009ab7326d_field_593a81a41c9f6] => 

    So cannot loop with for each anymore. using the_row with get_sub_field works as expected though and I can see the data when looping this way.

    Any ideas why this would return as above with get_field?

  • Can you supply a portion the code that was working and now isn’t?

  • Sure, have condensed:

    $disclaimers = get_field(‘disclaimers’);

    if( !empty($disclaimers) ) {
    		foreach( $disclaimers as $disclaimer ) {
    		$disclaim_type = $disclaimer['disclaimer'];
    		#then looping through to generate a string

    This get_field gives an empty array as above in first post. So the foreach loop fails.

    If I do like this I can see the data as expected:

    if( have_rows('disclaimers') ) {
    		while( have_rows('disclaimers') ) {
    			// vars
    			$disclaimer = get_sub_field('disclaimer');

    I rolled back to version 5.10.2 and the first foreach snippet worked again.

  • I have a site that uses clone fields in exactly the same way that I just updated and everything is working as expected.

    I need to know more information about your code. Is this called in the template file? is it in a plugin files? When is it called? Is it possible that this is called before the acf/init action has fired?

  • Thanks for asking the right questions. I looked deeper and was trying get_field first and then if that returned nothing trying get_sub_field. This output must have been updated within the update so have updated it to account for this.

    Thanks for your help!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.