Home › Forums › Add-ons › Repeater Field › Dynamically populate repeater field with select field › Reply To: Dynamically populate repeater field with select field
Well I solved the issue. I modified the priority of my filters, and instead of using the field name, I used the field keys. Code ended up like this:
I changed the priority on the select field population function to run before the repeater population
add_filter('acf/load_field/name=item_shipped', 'opo_item_select_options', 9, 1);
function load_opo_items_to_ship( $value, $field, $post_id ){
$opo_id = url_to_postid( get_permalink());
$value = array();
if( have_rows('po_information_purchase_order_items', $opo_id) ) {
while( have_rows('po_information_purchase_order_items', $opo_id) ) {
the_row();
$value[] = array(
'field_5c76cc4bace4b' => get_sub_field('opo_item_ordered'),
'field_5c76ccb3ace4c' => get_sub_field('opo_item_description'),
);
}
}
return $value;
}
add_filter('acf/load_value/key=field_5c76cc36ace4a', 'load_opo_items_to_ship', 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.