Hi,
I’m a little confused about how to amend my front end form code, to send an email to one or possibly more people when the form has been submitted.
The form is only for those who are logged into the website. The form also creates a new (custom post type) post and saves as ‘pending’ status for admin to approve.
<?php
$options = array(
'id' => 'acf-form-kb-article',
'honeypot' => true,
'post_title' => true,
'post_content' => true,
'field_groups' => array(174),
//'return' => $siteurl . '/question-submitted/',
'return' => $returnurl,
'comment_status' => 'open',
'updated_message' => __('Question submitted', 'iexpe'),
'post_id' => 'new_post',
'honeypot' => true,
'new_post' => array(
'post_type' => 'knowledgebase',
'post_status' => 'pending'
),
'submit_value' => __('Ask the Question!', 'iexpe')
);
acf_form( $options );
Any help would be much appreciated.
Sending an email would happen in by either creating an acf/save_post filter https://www.advancedcustomfields.com/resources/acf-save_post/ or an acf/pre_save_post filter https://www.advancedcustomfields.com/resources/acf-pre_save_post/
There is an example of acf/pre_save_post here https://support.advancedcustomfields.com/forums/topic/have-cpt-form-send-an-email/
and an example using acf/save_post here https://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/
So I can leave my code alone, but then add the code you’ve linked too (one of them, not both!), within my functions.php file – is that correct?
Thanks for the reply, I really appreciate it.
The topic ‘Send Email Front End Form’ is closed to new replies.
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.