• I am trying to execute some PHP script with contact form 7 but none of the hooks working. I am using a new version of wordpress, contact form plugin. Tried wpcf7_before_send_mail and wpcf7_mail_sent

    Sample code in functions.php file:

    add_action('wpcf7_before_send_mail','_wpcf7_mail_sent_function');
    add_action( 'wpcf7_mail_sent', '_wpcf7_mail_sent_function'); 
    
    function _wpcf7_mail_sent_function( $contact_form ) {
        $title = $contact_form->title;
        $submission = WPCF7_Submission::get_instance();  
        error_log("test");
        wp_mail('[email protected]', 'contact form 7', 'Hooks not working');
        print_r( $submission);
        
        die;
    }
  • The topic ‘Contact form 7 hooks not working at all’ is closed to new replies.