Answers for "acf get all checkbox options"

PHP
0

acf get all checkbox options

<?php  
  // If your ACF field return option is set to value then:
  $data= get_field_object('types'); // where types is the acf field name 
  $types= $data["choices"]; // ACF use the parameter choices as the options array data
?>
<select name="my-types">
  <option value="">Select...</option>
  <?php foreach($types as $type){ ?>
     <option><?php echo $type; ?></option>
  <?php } ?>
Posted by: Guest on January-12-2022

Browse Popular Code Answers by Language