wpcf7_before_send_mail not being called?
-
function wpcf7_addto_newsletter (&$WPCF7_ContactForm) { /* Use WPCF7_Submission object's get_posted_data() method to get it. */ $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); $id = $posted_data->id; $title = $posted_data->title; } wp_mail( '[email protected]', 'title'.$id.' '.$title, 'The message' ); } function wpcf7_init_before() { add_action("wpcf7_before_send_mail", "wpcf7_addto_newsletter"); } add_action("init", "wpcf7_init_before");
I have written the code above and if I add a wp_message into the init function it’s being sent, but the one in the addto_newsletter is never sent.
I have WordPress 4 with 4.0.1 of the plugin, the forms are being emailed correctly, and if I introduce a syntax error it is picked up, it just appears the function is not being run?
Please can any one spot what I have done wrong.
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wpcf7_before_send_mail not being called?’ is closed to new replies.