Support

Account

Home Forums General Issues Defining field wrapper ID Reply To: Defining field wrapper ID

  • Sorry, did not see your follow up question. For some reason I stopped getting notification, not sure why.

    Anyway, giving each field in a repeater a unique value is somewhat harder. You need to have a way to keep track of the last value you assigned and increment it. I think something like this could work.

    
    function my_acf_load_field($field) {
        static $count = 0;
        $count++;
        $field['wrapper'] = array(
            'id' => 'unique_'.$count;
        );
    
        return $field;
    }
    	
    	add_filter('acf/load_field/key=field_123', 'my_acf_load_field');