Support

Account

Home Forums Add-ons Repeater Field get_field_object on Nested Repeater

Unread

get_field_object on Nested Repeater

  • function get_field_data($field,$post_id){
    	
    	$name = $field['name'];
    	
    	if($field['type'] == 'repeater'){
    		
    		$subfields = $field['sub_fields'];
    		
    		foreach($subfields as $subfield){
    			$subfield_data = get_field_data($subfield['key'],$post_id);
    			$array[$subfield['key']] = $subfield_data;
    		}
    		
    		return $array;
    	}else{
    		$field_data = get_field_object($field['key'],$post_id);
    		return $field_data;
    	}
    }

    in the 2nd level for subfields all values are blank

    is get_field_object not working on sub-sub_fields?

    as you can see in the JSON the data get corrupted in the second level

Viewing 1 post (of 1 total)

The topic ‘get_field_object on Nested Repeater’ is closed to new replies.