Home > Enterprise >  How to get specific property from contact form 7 (WordPress) object?
How to get specific property from contact form 7 (WordPress) object?

Time:05-22

I am very new to programming and I would like to extract and save the email address of the person who use my contact form 7.

I am able to extract the contact form id by using

function action_wpcf7_mail_failed( $contact_form ) { 

   $aet_formid = $contact_form->id; // this returns the id of the contact form

}

but when I use

$aet_form_email = $contact_form->post_author_email; // this returns null

May I know which property should I use to get the email that the user has entered into the form?

I really appreciate any help you can provide.

CodePudding user response:

please add this to your function:

 $submission = WPCF7_Submission::get_instance(); 
 $posted_data = $submission->get_posted_data();

the $posted_data variable hold all values you need.

  • Related