Reply To: Make the email and phone black out in the message content. It's possible?


Home Forums Front End PM PRO Make the email and phone black out in the message content. It's possible? Reply To: Make the email and phone black out in the message content. It's possible?

#28358
Shamim Hasan
Keymaster

You can add following code in your theme’s (child theme’s if you are using) functions.php

add_filter( 'fep_filter_message_before_send', function( $message ) {
	// The @ symbol must be surrounded by character on both sides
	$message['message_content'] = preg_replace( '/[^@\s]*@[^@\s]*\.[^@\s]*/', '[EMAIL]', $message['message_content'] ); # for emails
	
	// Take any string that contains only numbers, spaces and dashes,
	// Can optionally have a + before it.
	$message['message_content'] = preg_replace( '/\+?[0-9\-]{5,}/', '[PHONE]', $message['message_content'] ); # for phone numbers
	
	return $message;
});

It will work most of the time.