jQuery('[name="post-id"]').val(); // ajouter un ACF avec le slug "email_contact" sur les posts, lorsqu'il sera rempli pour un post alors l'email sera envoyé à l'adresse renseignée, sinon à l'adresse par défaut de Contact Form // ajouter dans functions.php : /* destinataire custom pour Contact Form 7 en fonction de l'id du post et d'un meta ACF email_contact */ function wpcf7_before_send_mail_function($contact_form, $abort, $submission) { $posted_datas = $submission->get_posted_data(); if ($posted_datas['post-id']) { $email_contact = get_post_meta(htmlspecialchars($posted_datas['post-id'],ENT_QUOTES), 'email_contact', true); if ($email_contact) { $properties = $contact_form->get_properties(); $properties['mail']['recipient'] = $email_contact; // si on veut garder l'admin en second destinataire : $email_contact.','.$properties['mail']['recipient'] $contact_form->set_properties($properties); } } return $contact_form; } add_filter('wpcf7_before_send_mail', 'wpcf7_before_send_mail_function', 10, 3);