Support

Account

Home Forums ACF PRO How to get repeater data to be used as a select? Reply To: How to get repeater data to be used as a select?

  • So I tried using this solution from https://support.advancedcustomfields.com/forums/topic/return-all-values-from-a-repeater-row-by-using-a-single-dynamic-select/ and it deletes the select field and adds two random blank fields

    function acf_load_contact_field_choices( $field ) {
        
    		// reset choices
    		$field['choices'] = array();
    	
    		// if has rows
    		if( have_rows('media_playlist') ) {
    			// while has rows
    			while( have_rows('media_playlist') ) {
    				// instantiate row
    				the_row();
    				
    				// vars
    				$contactName = the_sub_field('playlist_title');
    	
    				// append to choices
    				$field['choices'][ $contactName ] = $contactName;
    			}
    		}
    	
    		// return the field
    		return $field;
    		
    	}
    	add_filter('acf/load_field/name=color', 'acf_load_color_field_choices');