Support

Account

Home Forums General Issues Issue: WPML support: using repeatable fields in option fields Reply To: Issue: WPML support: using repeatable fields in option fields

  • Some more information to add which is missing in the answer above:
    This error only happens when you try to access all options at once using get_fields().

    Elliot meant that he can’t think of a quick and easy bug fix for this.

    However, there’s a workaround, where you don’t use get_fields(), but get_field() for every repeater. To still have them all accessible in one place, you can do something like this:

    
    // Put all repeater field names you have in your options fields in an array
    $options_repeater_names = array(
        'options_repeater_name_1',
        'options_repeater_name_2',
        'options_repeater_name_3',
    );
    
    $options_repeaters = array();
    
    // Loop through repeater field names and use get_field separately for each repeater field
    foreach ( $options_repeater_names as $field_name ) {
    	$options_repeaters[ $field_name ] = get_field( $field_name, 'options' );
    }
    
    // Now all the repeaters are accessible in $options_repeaters
    

    Good luck!