Created
October 4, 2019 23:48
-
-
Save mishterk/70bb486baac349c29b684346b77826ce to your computer and use it in GitHub Desktop.
Intercept and modify the payload sent by Advanced Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set the form key you wish to target | |
$form_key = 'form_5d97cf9edc0a8'; | |
add_action( "af/email/before_send/key=$form_key", function ( $email, $form ) { | |
add_filter( 'wp_mail', function ( $data ) use ( $email ) { | |
// you can override any items in this array to customise the email that is sent... | |
// $data['to']; | |
// $data['subject']; | |
// $data['message']; | |
// $data['headers']; | |
// $data['attachments']; | |
// e.g; | |
$data['subject'] = 'This is a custom subject'; | |
return $data; | |
} ); | |
}, 10, 2 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment