I have a listings
custom post type. Each listing has a custom field where an email can be entered. This is the owner of the listing and where the form will be sent.
I'm using the wpcf7_mail_components
hook to dynamically set the email:
function wpcf7_dynamic_email_field($components) { // Get email from post custom field // $email = '[email protected]'; // $components['recipient'] = $email; retu $components;
}
add_filter('wpcf7_mail_components', 'wpcf7_dynamic_email_field');
... but I'm not sure how to get the ID of the post the form was submitted from. I tried using get_theID()
or global $post; $post->ID
but that doesn't work.