Aug 07, 2019 9:44 pm
Is there any way to toggle html emails? I don't need registration or other core emails, just post notifications, so I'm not too concerned about filters.
I just want to make the forum emails match my other official emails.
I found the code below in a previous post but it crashed my site, Is there any other way to allow HTML in emails?
function my_custom_email_html_tags( $allowed_html ){
if( $allowed_post_html = wp_kses_allowed_html( 'post' ) ){
$allowed_html = $allowed_post_html
}
return $allowed_html;
}
add_filter( 'wpforo_kses_allowed_html_email', 'my_custom_email_html_tags');
4 Replies
Aug 08, 2019 1:57 pm
Hi @gunarcom,
I don't follow you well. Currently, wpForo allows sending HTML emails.
If there are some tags that are not allowed you should use the following hook:
add_filter('wpforo_kses_allowed_html_email', 'custom_wpforo_kses_allowed_html_email');
function custom_wpforo_kses_allowed_html_email($allowed_html){
if( !wpfkey($allowed_html, 'h1') ) $allowed_html['h1'] = array();
if( !wpfkey($allowed_html['h1'], 'style') ) $allowed_html['h1']['style'] = array();
if( !wpfkey($allowed_html, 'span') ) $allowed_html['span'] = array();
if( !wpfkey($allowed_html['span'], 'style') ) $allowed_html['span']['style'] = array();
return $allowed_html;
}
Aug 08, 2019 10:46 pm
Thanks, I guess it was just stripping out most of the email like tables, images, and divs.
I will try adding the tags into your filter. Thanks.