hi @hellowed,
try this (add to child theme functions.php or better, bp-custom.php) It will remove a and span and h1 html tag
function bpfr_remove_html_from_private_msg($message){
$replacement = '';
return preg_replace( "/ <(span|a|h1)[^>]*>/", $replacement, $message);
}
add_filter('messages_message_content_before_save', 'bpfr_remove_html_from_private_msg');
Hey @danbp,
WordPress provides a function for that. Check out wp_filter_nohtml_kses()
. It strips all HTML from the string you provide so there’s no need to use preg_replace()
.
function hellowed_remove_html_private_messages( $message ) {
$message = wp_filter_nohtml_kses( $message );
return $message;
}
add_filter( 'messages_message_content_before_save', 'hellowed_remove_html_private_messages' );
Wow, i searched for that and didn’t found. 👿 Thank you @henrywright for this information. 😀
Hello
Is it possible to remove HTML from all of the message boxes. Google feels the site is being hacked due to URL being inserted. I need to put a stop to this.
Any help appreciated.
Gary
Hello
There are message boxes in activity (public) and groups as well as private. Is the word private replaced with activity and groups for the other message boxes? If not, how do identify these?
Thanks for the support.
Gary