从数据选项中将联系人表格7下拉列表填充为(标签|值)

时间:2019-01-13 06:20:38

标签: wordpress contact-form-7

我正在使用以下内容填充选择标签数据: 在functions.php中:

function licence_years(){
    $data = array("less than 1 year", "1 year", "2 yeas", "3 yeas", "4 yeas", "5 yeas", "6+ yeas");
    return $data;
}

add_filter('wpcf7_form_tag_data_option', function($n, $options, $args){
    if (in_array('wpcf7.data.licence', $options)){
        return licence_years();
    }   
    return null;
}, 10, 3);

然后在表单中,我使用以下标记:

[select* licence data:wpcf7.data.licence]

这很好,但是,我需要选择标签上的值不同

我在Google上搜索后什么也没找到,有帮助吗?

0 个答案:

没有答案