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);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.