Tried to be as specific as possible in the title. Essentially I have a real estate site that I am working on that has property listings. The property listing is a custom post type and there are several other custom post types (each with their own custom fields) attached to it.
Each property has an agent (custom post type) attached to it with custom fields such as email, facebook, phone number, etc.
I need to dynamically pre-populate a hidden field on Gravity Forms with the agent email (which is NOT the same as the author email) so that I can send an email to that address.
I have tried the following with no luck because I'm sure something is missing to call the custom field from the Agent custom post type, but I'm not sure how. This is what I'm working with so far:
add_filter('gform_field_value_agentemail', 'populate_post_agent_email');
function populate_post_agent_email($value){
global $post;
$agents_email = get_post_meta($post->ID, 'agent_email', true);
return $agents_email;
}
I have added the parameter name "agentemail" to the gravity form field. If anyone knows what I am missing to be able to get this field (or any field from the agent custom post) into this form, it would be much appreciated.
Thanks.