Aww that’s a bummer. This thing’s driving me crazy.
In the meantime im just adding this to my functions.php
add_filter('wpcf7_hidden_field_value', 'limpiar_html_cf7hf');
function limpiar_html_cf7hf($value = '') {
$value = esc_html(wp_strip_all_tags( $value ));
return $value;
}
This will send the custom field content as plaint text.
I also tried another method:
function wpcf7_update_email_body($contact_form) {
$submission = WPCF7_Submission::get_instance();
$url = $submission->get_meta( 'url' );
global $post;
$the_post_id = $post->ID;
if ( $submission ) {
$mail = $contact_form->prop('mail');
$mail['body'] .= '<p> '. $url .' '. $post.'</p>';
$contact_form->set_properties(array('mail' => $mail));
}
}
I was trying to get the post id, but it will always return a 0 or nothing. Depends on how I try to get it. If I could get the post id, i would be able to attach the custom field content to the end of the mail’s body. If you are using ACF you could do something like $post = get_field(‘field_name’ , post_id) and that works. I hard coded it and it worked, html was fine on the mail.
So anyways, please let me know if you find a way to fix this. It would be awesome to render html tags correctly on mail.