Yes, you have explained it clearly. Good job on that.
The answer is not so simple however. When a field is hidden via conditional logic, it also becomes disabled. This prevents ACF from posting and saving the hidden value.
This stops the event of having 20 fields (hidden by conditional logic) entering null values into the DB.
I’m a bit nervous to add any code in ACF which actually removes a value – I can just see the support tickets flooding in about issues regarding this.
The simple answer is to make your template a bit more robust. Am I right in assuming that you are usig a function such as
get_field_objects to get all values and simple loop through them and output the value if there is one?
Is it possible for you to move away from this loop style coding? Towards a more strict code which you can then check the value of field C and take appropriate action?
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!