Created
August 25, 2024 00:08
-
-
Save pixelstorm/cf898784d5f224a7bebc511b43c36dc1 to your computer and use it in GitHub Desktop.
Using a wordpress posts meta field for dynamic gravity form emails
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 function agent_notification( $notification, $form) { | |
//This example is using a form with the id of 1 | |
if($form["id"] == 4){ | |
global $post; | |
//the example email is stored in a post meta field called "_cmb_email" | |
//$agent_email = get_post_meta( $post->ID , '_cmb_email', true ); | |
$agent_email = get_field('agent_email'); | |
$notification['to'] = $agent_email; | |
return $notification; | |
} | |
} | |
add_filter('gform_notification', 'agent_notification', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment