If you are in a situation where you wish to send email notifications only when a form creates a new post, you may use the af/form/email/recipient filter to override the recipient list based on the form's configuration args. A return value of FALSE will disable the notification email.
function only_send_mail_on_new_example( $recipient, $email, $form, $fields ) { // Check for correct form. if ( $form['key'] !== 'FORM_KEY' ) { return $recipient; } // Get form args. $args = AF()->submission['args']; // If form is set to create new posts, return the recipient list. if ( $args['post'] === 'new' ) { return $recipient; } // Otherwise, return false to disable sending of emails. return false; } add_filter( 'af/form/email/recipient', 'only_send_mail_on_new_example', 10, 4 );
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article