Dynamic recipient using custom field
-
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) { /* Retrieve email using post custom field */ // $email = get_field('listing_email', $id ); // $components['recipient'] = $email; return $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 usingget_the_ID()
andglobal $post; $post->ID
but neither work.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Dynamic recipient using custom field’ is closed to new replies.