WordPress $cf7->posted_data Missing – no data available to push to sessions

Suddenly (I did nothing) my Contact 7 forms (wordpress) stopped working properly.

My functions.php was working with the submitted data – affecting all my forms.
This is affecting 2 sites I manage and seemed to happen to both at same time.

Read More
    add_action('wpcf7_before_send_mail', 'my_conversion');

    function my_conversion($cf7)
    {
    $firstname = $cf7->posted_data["FirstName"];  
    }

The problem is that $cf7->posted_data[“FirstName”] is blank for some reason – no value. Yet my form has a field named FirstName.

Any ideas?

Suddenly my $cf7-posted_data is empty…even when I try and push the data to a session (I have sessions working on my wordpress sites) the value is empty…

Related posts

Leave a Reply

1 comment

  1. If you have CF7 v3.9 the posted_data property is depreciated see below…

    /* WPCF7_ContactForm object no longer has a posted_data property. */
    $posted_data = $contact_form->posted_data; // Wrong.
    
    /* 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();
    }