Last active
August 29, 2015 14:19
-
-
Save FriendlyWP/8a65ce993f8c3b3fc322 to your computer and use it in GitHub Desktop.
Dynamically add to Gravity Forms notification email address list (include emails stored in a custom post meta field).
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
// change # to the id of your form to target a specific form | |
add_filter( 'gform_notification_#', 'route_notification', 1, 2 ); | |
function route_notification($notification, $form , $entry) { | |
global $post; | |
// the $post here is the post where the Form is displayed | |
$email_to = get_post_meta($post->ID, 'email', true); | |
if ($email_to){ | |
$notification['to'] .= ',' . $email_to; | |
} | |
return $notification; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment