是的,这可以使用CF7\'wpcf7_mail_tag_replaced\'
滤器
add_filter(\'wpcf7_mail_tag_replaced\', \'format_chackbox\',10,4);
function format_chackbox($replaced, $submitted, $is_html, $mail_tag){
//you can check if this is the right field if need be.
if(\'my-checkbox-field\' != $mail_tag->field_name()) return $replaced;
//$submitted contains the raw submitted data.
//$replaced is the formatted data, you can use either.
$a = explode(\',\', $replaced);
//check if you have multiple values and the email accepts html (set with the use html checkbox in the mail notification settings).
if(is_array($a) && $is_html){
$replaced = \'<ul>\'.PHP_EOL;
foreach($a as $v) $replaced .= \'<li>\'.trim($v).\'</li>\'.PHP_EOL;
$replaced .= \'</ul>\'.PHP_EOL;
}
return $replaced;
}
将此放置在
functions.php
文件