Foreach get_field_object for ACF

admin

Administrator
Staff member
I have a custom field on wordpress that defines a select option

Code:
one : First
two : Second
three : Third
four : Fourth

I am trying to call these options on the frontend in a select form i.e.

Code:
<select id="filters">
  <option value="*">show all</option>
  <option value="one">First</option>
  <option value="two">Two</option>
  <option value="three">Third</option>
  <option value="four"Fourth</option>
</select>

This is what i got so far and it doesnt seem to be working:

Code:
<?php 
$field_name = "team_category";
$field = get_field_object($field_name);

foreach($field){
  echo $field['label'] . ': ' . $field['value'];
}
?>