Support

Account

Home Forums General Issues Get one of each select value if it's used Reply To: Get one of each select value if it's used

  • I would loop over the repeater once, gather all of the values into an array and then use the array.

    A simple example:

    
    $values = array();
    while (have_rows($repeater) }
      the_row();
      $value = get_field('sub_field');
      if (!in_array($value, $values) {
        $values[] = $value;
      }
    }
    // loop over the array and do something with each value.