问题
I have a Repeater field which creates "jobs" each job has title, text as sub-fields and also a contact form 7 form which sends jobs applications.
I want to add hidden field which will also send the sub-field "title" so whenever form is submitted we know which job the sender sent the application from
Tried to use:
Contact Form 7 Dynamic Text Extension
but it is not working with ACF as far as I'm concern any help will be appreciated
回答1:
you could use CF7's 'wpcf7_form_hidden_fields' filter before your form is displayed,
add_filter('wpcf7_form_hidden_fields', 'add_job_title');
function add_job_title($hidden){
//$current_job is the currenlty job loaded.
$hidden['job_title']= $current_job->sub_title;
return $hidden;
}
when the form is submitted, $_POST['job_title']
will have the value of the hidden field.
来源:https://stackoverflow.com/questions/64888628/advanced-custom-field-acf-repeater-contact-form-7