How to get current post ID in Contact Form 7 wpcf7_before_send_mail hook action
Due to a backwards-incompatible change in version 5.2, you can no longer retrieve the form’s meta data using get_posted_data(). Instead, you can use the id value in the array returned by get_current(): $contact_form = WPCF7_ContactForm::get_current(); $contact_form_id = $contact_form -> id;