Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sarathlal-old/8cf9f7362ff0a9de4848a366826befc0 to your computer and use it in GitHub Desktop.
Save sarathlal-old/8cf9f7362ff0a9de4848a366826befc0 to your computer and use it in GitHub Desktop.
add_filter('wp_mail_from', 'notification_from_email');
add_filter('wp_mail_from_name', 'notification_from_name');
function notification_from_email($email_address){
$blog_url = get_site_url();
$output1 = str_replace(array('http://','https://', 'www'), '', $blog_url);
$output2 = strstr($output1, '/', true);
if($email_address === "wordpress@" . $output2)
return 'noreply@'. $output2;
else
return $email_address;
}
function notification_from_name($email_from){
if($email_from === "WordPress")
return get_bloginfo( 'name' );
else
return $email_from;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment