Home › Forums › Front-end Issues › acf_form() for contact form without creating a post › Reply To: acf_form() for contact form without creating a post
That may work as well. The reason that I say to just unset $_POST[‘acf’] is that this is what acf_form_head() does.
1) Verify the nonce
2) Validate the values
3) Runs your pre_save_post filter if any. I’m assuming that you’d put your code to send an email into this filter
4) Calls acf_save_post()
The first thing that acf_save_post() does it to see if $_POST[‘acf’] contains anything, if it’s empty then it returns without saving anything.
The only place this will be a problem is if there is an error during the submission process, for example they didn’t enter an email address into an email field.
Like I said, your solution might work as well, you just need to remove the line that calls acf_save_post()
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!
© 2022 Advanced Custom Fields.