Question

I am writing a custom function to populate an email field in gravity forms in wordpress. I would like to call my custom field-"app_email-address" that is present in each post to the email field.

If is use the below function, the email field is populated with the author email however i want the email field to be populated with the app_email-address. How do I go about with it. Please help.

add_filter('gform_field_value_author_email', 'populate_post_author_email');
function populate_post_author_email($value){

global $post;
$author_email = get_the_author_meta('email', $post->post_author);
return $author_email;
}
Was it helpful?

Solution

You can use get_post_meta

$app_email=  get_post_meta($post->ID,'app_email-address',true);

WP get_post_meta

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top