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;
}
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.