Home › Forums › Bug Reports › Conditional fields data stored when condition not met › Reply To: Conditional fields data stored when condition not met
There isn’t a setting to do this and this topic has come up in the past. When the field is hidden by conditional logic it is not submitted. Anything that is not submitted is not updated. This is a JS only thing and does not effect the fields. When fields are being saved ACF is unaware of the conditional logic associated with each field……
Long story short: If you want to do this then you need to add your own filters/actions to accomplish it. acf/save_post https://www.advancedcustomfields.com/resources/acf-save_post/
When building templates you should not be basing display of the field on the content of the conditional field but on the condition field.
Let’s say that I have 2 fields “show_price” and another field “price”
if (get_field('show_price')) {
the_field('price');
}
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.