问题描述
我想动态添加单选按钮形成 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 (将#修改为@)