I am trying an IF statement to check if the user has actually selected a value in the ACF DatePicker but this doesn't validate correctly. Any ideas?

$fxdate = get_field('fl_date');
if (isset($fxdate)) {echo "set";} else {echo "not set";}

Please check if echoing $fxdate is working.

$fxdate = get_field('fl_date');

In ACF simply below code works,

if($fxdate){ echo "set"; } else { echo "not set"; }
| improve this answer | |
  • this doesn't work for me – JoaMika Jun 30 '18 at 10:39

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.