advanced custom field (ACF) Repeater + Contact Form 7

对着背影说爱祢 提交于 2021-01-07 02:44:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!