Support

Account

Home Forums Add-ons Repeater Field dynamically generate subfield content Reply To: dynamically generate subfield content

  • To anyone reading this now, DACrosby’s answer still works except you have to wrap the array keys within the $value[] array with quotes (e.g. ‘field_54aa5beb008b1’ )

    
    add_filter('acf/load_value/key=field_54aa5b3b008b0',  'afc_load_my_repeater_value', 10, 3);
    function afc_load_my_repeater_value($value, $post_id, $field) {
    	if ($post_id === false) {
    		$value	= array();
    		$value[] = array(
     
    			'field_54aa5beb008b1'/* Correct */ => 'Hours',
    			field_54aa5c25008b2 /* Incorrect */ => 1
    		);
    	}
    	return $value;
    }