如何解决重力表单在提交时动态填充单选按钮为空
我想动态添加单选按钮形成 wordpress 术语,但我想将其保存到数据库中。如果需要,则支票将是假的。是否可以帮助理解为什么重力形式的示例在单选按钮上不起作用?
这是我的代码:
add_filter('gform_pre_render_1','populate_cat_members');
add_filter('gform_pre_validation_1','populate_cat_members' );
add_filter('gform_pre_submission_filter_1','populate_cat_members' );
add_filter('gform_admin_pre_render_1','populate_cat_members');
function populate_cat_members($form)
{
foreach ($form['fields'] as $field) {
if ($field['id'] == 32) {
$terms = get_terms('cat_members',array('hide_empty' => false,'oderby' => 'name'));
$choices = array();
$numItems = count($terms);
foreach ($terms as $post) {
$choices[] = array('text' => $post->name,'value' => $post->term_id);
}
$field->choices = $choices;
}
}
return $form;
}
谁能帮帮我,为什么我不能保存数据?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。