• Resolved fifteenit

    (@fifteenit)


    Hi,

    I’m looking to modify the form output before it sends the email using the base plugin hook “wpcf7_before_send_mail” to dynamically add a file attachment. I’ve created the following function:

    do_action( 'wpcf7_before_send_mail',  'my_function'); 
    
    function my_function($wpcf7) { 
      echo 'test';
    }

    and I receive the following error:

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function CF7CF::hide_hidden_mail_fields(), 1 passed in /home/fifteeni/test.domainname.co.uk/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /home/domainname/test.domainname.co.uk/wp-content/plugins/cf7-conditional-fields/cf7cf.php:239

    I’ve tried adding two more parameters to the function call to make sure I capture all of the incoming arguments but I receive the same error.

    Can anyone please help?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘PHP error when trying to use wpcf7_before_send_mail’ is closed to new replies.