If possible I would like to add the code (which I asked for above) to the excellent function that you had already done to me.
add_filter( 'fep_filter_message_before_send', function( $message ) {
if ( get_user_meta( get_current_user_id(), 'privacytel', true ) != 'No') {
// The @ symbol must be surrounded by character on both sides
$message['message_content'] = preg_replace( '/[^@\s]*@[^@\s]*\.[^@\s]*/', '[EMAILNASCOSTA]', $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,}/', '[TELEFONONASCOSTO]', $message['message_content'] ); # for phone numbers
}
return $message;
});
Thanks.