Support

Account

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

  • I’m able to set the value of the repeater so that the number of subfields matches the number of subfields in my options repeater.
    But I still don’t understand how you would go about setting the values of the subfields from there. If I try to access the subfields I only get the structure and not the content. So even if I wanted to create another filter for each subfield I wouldn’t know the field_key to do so.

    function repeater_field_load_value($value, $post_id, $field) {
    		
        $keywords = get_field('app_store_metadata_keywords', 'option', true);
        $num_of_keywords = sizeof( $keywords );
    	
        if ( $value != $num_of_keywords ) {
            $value = $num_of_keywords;
        }
        
        // This doesn't show any value for the subfields ?
        echo '<pre>';
        print_r( $field['sub_fields'] );
        echo'</pre>';
    	
        return $value;
    }
    
    add_filter($'acf/load_value/name='my_field_name', 'repeater_field_load_value', 10, 3);