Skip to content

Instantly share code, notes, and snippets.

@FriendlyWP
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FriendlyWP/8a65ce993f8c3b3fc322 to your computer and use it in GitHub Desktop.
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).
// 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