Home › Forums › Front-end Issues › Front End Form send email › Reply To: Front End Form send email
Hi @jonathan, thanks for replying.
My action that I’m setting up looks like this:
add_action('acf/save_post', array($this, 'my_acf_save_post'), 20);
The function itself looks like:
function my_acf_save_post($post_id) {
if(get_post_type($post_id) == 'my_custom_post_type') {
$post = get_post($post_id);
$custom = get_post_custom($post_id);
$toEmail = get_bloginfo('admin_email');
$subject = 'Example Subject';
$email_body = 'Example Body Content';
$was_email_sent = wp_mail($toEmail, $subject, $email_body);
}
}
One thing I feel that I should mention is that my add_action method is being called in my plugin’s constructor.
Thanks,
Alan
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.