• How to set the form field after validation? Before validation it’s posible:

    add_action('wpcf7_posted_data', 'my_fun', 10, 1);
    
    function my_fun($form_data) {
      $form_data['my-field'] = 'some value';
      return $form_data;
    }

    But how can I achieve this after validation?

    add_action('wpcf7_before_send_mail', 'my_fun', 10, 3);
    
    function my_fun($cf7, $abort, $submission) {
      // ??? = 'some value';
      return $cf7;
    }
    add_action('wpcf7_submit', 'my_fun', 10, 3);
    
    function my_fun($cf7, $result) {
      // ??? = 'some value';
    }

    I have hidden input in my form. My goal is to set this field with data from external API (but after form validation).

  • The topic ‘How to set the form field after validation’ is closed to new replies.