Home › Forums › ACF PRO › Setting `required` to `false` inside `acf/prepare_field` doesn't have any effect › Reply To: Setting `required` to `false` inside `acf/prepare_field` doesn't have any effect
acf/prepare_field is only run before the field is displayed on the admin and has no effect when ACF is validating the field since the field is not being displayed when it is being validated. So this filter will not work for what you’re trying to do.
You can set required to false when setting up the field
You can set required to false with acf/load_field https://www.advancedcustomfields.com/resources/acf-load_field/
Or you can set the field requited to false and then create an acf/validate_value filter for those cases when you want it to be required https://www.advancedcustomfields.com/resources/acf-validate_value/
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!
© 2023 Advanced Custom Fields.