Home › Forums › ACF PRO › acf/load_field/ and repeaters › Reply To: acf/load_field/ and repeaters
Hi,
I figured out that this is not possible.
Repeater
– Repeater
– – Text Field
– Repeater
– – Select Field Loaded from Text Field Above
The error was Trying to get property of non-object
So I rethought the data and realized I dould get rid of one of the parent repeater went with this
– Repeater
– – Text Field (result_title)
– Repeater
– – Select Field Loaded from Text Field Above (yes_complete_target)
The code then is
add_filter('acf/load_field/name=yes_complete_target', 'acf_load_complete_field_choices');
function acf_load_complete_field_choices($field){
global $post;
$post_id = $post->ID;
$field['choices'] = array();
//Get the repeater field values
$choices = get_field( 'dt_result', $post_id );
$keys = array_keys($choices);
for($i = 0; $i < count($choices); $i++) {
foreach($choices[$keys[$i]] as $key => $value) {
if($key == 'result_title'){
$title = $value;
//echo $value . "<br>";
$field['choices'][$title] = $title;
}
}
}
return $field;
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.