Hi?@adcapaust
You can remove the if statement in the first functions if you dont use that.
In my case It will send a new user 2 mails, 1 from wordpress and 1 from ultimate members and I want to make sure my client will never have the ability to do that. So i just filter that email.
add_filter('wp_mail', 'prevent_duplicate_user_notification_email');
function prevent_duplicate_user_notification_email($args) {
// Check if the email is a new user notification email with the specific subject
if (strpos($args['subject'], '{specific subject you can remove this if statement if you want.}') !== false) {
$args['to'] = ''; //Set adress to empty string so it wouldnt get send.
}
// Modify the email image urls
$args['message'] = modify_email_image_urls($args['message']);
return $args;
}
function modify_email_image_urls($content) {
// This pattern matches image URLs that start with "https://"
$pattern = '/<img[^>]+src="\K\/\/[^"]+/';
// This is the callback function that prepends "https:" to the URL
$callback = function ($matches) {
return "https:" . $matches[0];
};
return preg_replace_callback($pattern, $callback, $content);
}