Support

Account

Home Forums General Issues Dynamically populate between 2 repeater fields Reply To: Dynamically populate between 2 repeater fields

  • function acf_load_field_choices( $field ) {
        
        // reset choices
        $field['choices'] = array();
    
        // if has rows
        if( have_rows('ACFG01-F01', 'option') ) {
            
            // while has rows
            while( have_rows('ACFG01-F01', 'option') ) {
                
                // instantiate row
                the_row();
                
                
                // vars
                $value = get_sub_field('ACFG-F01-SOURCE');
                $label = get_sub_field('ACFG-F01-SOURCE');
    
                
                // append to choices
                $field['choices'][ $value ] = $label;
                
            }
            
        }
    
        // return the field
        return $field;
        
    }
    
    add_filter('acf/load_field/name=ACFG-F01-TARGET', 'acf_load_field_choices');

    Anyone?