• Hello,
    I use a lot the hook “wpcf7_before_send_mail” in various project. Up until recently I used this code to get for example the ID of the origin form:

    $posted_data = $submission->get_posted_data();
    $id = $posted_data["_wpcf7"];
    

    And it worked fine. From version 5.2 this no longer works.

    In a similar way
    $posted_data["your-product-image"]
    Used to return the name of file (eg. example.jpg), now it contains an hash.

    Can’t find any word about those changes in the releases notes…

Viewing 1 replies (of 1 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    $submission = WPCF7_Submission::get_instance();
    
    // Retrieving the contact form ID
    $contact_form = $submission->get_contact_form();
    $id = $contact_form->id();
    
    // Retrieving the uploaded file name
    $uploaded_files = $submission->uploaded_files();
    $file_name = wp_basename( $uploaded_files['your-product-image'] );

    Release notes are basically written for non-developer users.

Viewing 1 replies (of 1 total)
  • The topic ‘The behaviour of get_posted_data(); changed?’ is closed to new replies.