Home › Forums › General Issues › Dynamically populate between 2 repeater fields › Reply To: Dynamically populate between 2 repeater fields
function acf_load_field_choices( $field ) {
// reset choices
$field['choices'] = array();
// if has rows
if( have_rows('ACFG01-F01', 'option') ) {
// while has rows
while( have_rows('ACFG01-F01', 'option') ) {
// instantiate row
the_row();
// vars
$value = get_sub_field('ACFG-F01-SOURCE');
$label = get_sub_field('ACFG-F01-SOURCE');
// append to choices
$field['choices'][ $value ] = $label;
}
}
// return the field
return $field;
}
add_filter('acf/load_field/name=ACFG-F01-TARGET', 'acf_load_field_choices');
Anyone?
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.