Support

Account

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