Home › Forums › Front-end Issues › If statement not working when field is empty › Reply To: If statement not working when field is empty
So, you are getting a value.
1) There is another field attached to the post with the same name
2) you are using conditional logic to hide the image field, the image field will still have a value even if it’s hidden. If you are using conditional logic then you need to do the if on that conditional field and not the image field.
3) get_the_ID() is returning the wrong post ID
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.