问题描述
我需要使用 CF7 wordpress 表单在选择选项中插入值。
我正在使用自动填充联系表单的代码,但现在我需要插入一些定义为自定义字段的值。
这是有效的代码:
function mrfx_add_plugin_list_to_contact_form ( $tag,$unused ) {
if ( $tag['name'] != 'location' )
return $tag;
$args = array ( 'post_type' => 'page','post_parent' => '8','numberposts' => 99,'orderby' => 'ID','order' => 'ASC' );
$plugins = get_posts($args);
if ( ! $plugins )
return $tag;
foreach ( $plugins as $plugin ) {
$tag['values'][] = $plugin->post_title;
$tag['labels'][] = $plugin->post_title;
}
return $tag;
}
add_filter( 'wpcf7_form_tag','mrfx_add_plugin_list_to_contact_form',10,2);
// Source: https://www.leewillis.co.uk/dynamic-select-list-contact-form-7/
add_filter( 'acf/load_value','do_shortcode' );
但现在我需要用这样的东西替换 $tag['values'][] = $plugin->post_title;
$tag['values'][] = array ($plugin->the_field('email',$page->ID),$plugin->post_title);
最终的范围是在我的选项中具有这个结构:value="email|title"。
谢谢:)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)