Support

Account

Home Forums Add-ons Repeater Field get_sub_field() not working with repeater element

Helping

get_sub_field() not working with repeater element

  • Hi,

    I’m having trouble using the get_sub_field() function for one repeater element after updating the plugin. We are on version 5.7.9 now and we were previously on 5.5.11. We’re also running WordPress 5.0.3.

    The repeater in question is called “Program” and consists of two elements: “Program Name” (text field) and “Courses” (another repeater). The courses sub field is a repeater of Post Object elements.

    Up until the update, I was able to execute all of my code fine. After the update, the Program Name field resolves into the variable, but the courses field seems to fail silently. I’ve checked our error logs but I can’t find any fatal errors or warnings or anything. All code execution seems to stop after get_sub_field('courses').

    Are there any known issues with repeater fields containing Post Objects or repeaters within repeaters? Any tips on how to troubleshoot issues like this? Any information would be extremely helpful.

    Thanks!

    My code looks a bit like this:

    
    if ( have_rows( 'program', $entityID ) ) {
    	while ( have_rows( 'program', $entityID ) ) {
    		the_row();
    		$programName = get_sub_field( 'program_name' );
    		$courses = get_sub_field( 'courses' );
    	}   
    }
    
  • Hi, for what it’s worth, I downgraded back to ACF 5.5.11, without changing any code, and everything is working again.

    I hope that helps with any troubleshooting.

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

The topic ‘get_sub_field() not working with repeater element’ is closed to new replies.