Issue with wpcf7_before_send_mail
-
Hi
I am relatively new to wordpress and needed some help with the contact form 7 plugin.
I tried to create a hook for wpcf7_before_send_mail by adding the following piece of code in the functins.php file of my active theme:function update_message_body($cf7){ if($cf7->id == 7){ $name = $cf7->posted_data["your-name"]; $cf7->mail['body'] = "Hello ".$name; } } add_action("wpcf7_before_send_mail", "update_message_body");
The purpose is to generate the message body dynamically based on user inputs and this code is just an initial test.
After clicking the send button, however, the spin arrows keep rotating without giving the success message. Even though, the mail is delivered, the message body is not generated as required. Moreover, when this piece of code is removed the issue with the send arrows disappear indicating that there is some issue with my code.Could you tell me what I am doing wrong and how to troubleshoot this.
I am using wordpress v3.9.2, contact form 7 v3.9.1.
Thanks
Varun
- The topic ‘Issue with wpcf7_before_send_mail’ is closed to new replies.