HTML globaal inschakelen voor CF7-mails
· door Daniel
Wil je ‘HTML gebruiken’ niet in elk Contact Form 7-formulier aanzetten, gebruik dan dit codefragment:
function we_cf7_always_use_html($cf){
$wpcf7 = WPCF7_ContactForm::get_current();
$submission = WPCF7_Submission::get_instance();
if (!$submission){
return;
}
$mail2 = $wpcf7->prop('mail_2');
if(!empty($mail2)) {
$mail2['use_html'] = true;
$wpcf7->set_properties( array("mail_2" => $mail2)) ;
}
}
add_action( 'wpcf7_before_send_mail', 'we_cf7_always_use_html' );
Zo wordt het filter use_html voor alle mails ingeschakeld.