Contact Form 7: use hook created using wpcf7_before_send_mail for only one contact form by id
I am working on a site with several forms created using Contact Form 7. For one of these forms, I am passing variables that I collected using a hidden input field in the form. I am passing these variables into the email using the wpcf7_before_send_mail hook, but these values are passing into every email (I added dynamic variables as well as static text) Here's the code: add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' ); function wpcf7_add_text_to_mail_body($contact_form){ $values_list = $_POST['valsitems']; $values_str = implode(", ", $values_list); // get mail property