Home › Forums › Front-end Issues › Submit frontend form even if validation fails › Reply To: Submit frontend form even if validation fails
Before I start, let me say that I don’t know anything about the functions that you mention and that this is not a solution but a direction for you to look in.
I don’t think that you can stop ACF from validating fields and showing errors and make it allow the submission of the form when there are errors. The first step will be that you need to remove all of the settings for fields that require fields, you simply will not be able to use the validation.
The next step will be for you to create your own ac/pre_save_post filter https://www.advancedcustomfields.com/resources/acf-pre_save_post/, or you can probably use the acf/save_post filter. This depends on what you want to do. If you want to save a post as a draft or published based on validation then I’d probably go with pre_save_post, but the other can be used just as easily as you and always update the post status based on validation as well.
Anyway, if I understand what acf_add_validation_errro()
does, in your filter you would do all the validation yourself and use this function set all errors for all fields yourself.
Hope that helps you get to where you’re going.
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG
— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.