Home › Forums › General Issues › Using acf/validate_value to validate repeater field › Reply To: Using acf/validate_value to validate repeater field
Thanks for sharing your code.
I may be mistaken, but I believe that I can add a simplification to ituk’s post. If you just want the first item in the repeater, you can target it with the  array index without needing to reset the repeater field. So the following chunk of ituk’s code:
$repeater_field = $_POST['acf']['field_57bc841e7f973']; //repater parent key reset($repeater_field); //reset repeater array to the rist row $first_field = key($repeater_field); //get first key in the repeater array $my_text_field = $_POST['acf']['field_57bc841e7f973'][$first_field]['field_57bc8a5447d06']; //specific field
can be simplified to this:
$my_text_field = $_POST['acf']['field_57bc841e7f973']['field_57bc8a5447d06']; //specific field
NOTE: This only works for the 1st item! It seems that the first item uses the  array index but each repeater subfield that gets added gets a randomly generated array index. So instead of going to  for the second item it will be something like [58b641f67f3de], which is a randomly generated string that is probably generated from the server’s timestamp.
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!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.— Advanced Custom Fields (@wp_acf) January 6, 2023
© 2023 Advanced Custom Fields.