0

I have an ACF field (options) that contains a list of options:

Blue
Red
Green

I would like to echo the option selected, ie:

if(get_field('blue') == true) {
  echo "You have selected the color Blue";
}
1

While writing out this troubling question, alas! the answer did fall from the heavens and presenteth itself unto me:

$meta = get_post_meta( get_the_ID(), 'options');

 if(in_array('blue',$meta)) {
   echo "You've selected blue, punk!";
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.