YPSA Webmaster's Blog

Skip to content Skip to sidebar

Change “From” name of email in WordPress when it sends notifications to users

This snip of code lets you customize the email “from” that appear on emails sent from WordPress. By default the “From Name” on emails sent from wordpress has a name “WordPress”.  To change from name with your blog name, simply copy and paste the code into the function.php file of your theme.


// change mail from name
function reset_fromname($email){
 $wpfrom = get_option('blogname');
 return $wpfrom;
}

add_filter('wp_mail_from_name', 'reset_fromname');

You can also change From email address. To do this, insert code below into functions.php


// change  from email address
function reset_fromemail($email){
 $wpfromemail = 'example@yourdomain.com';
 return $wpfromemail;
}

add_filter('wp_mail_from', 'reset_fromemail');

About the author

Abdullah Al Shakir

I am a web developer and graphics designer have been working in YPSA as webmaster since 2006. I am expert in XHTML, CSS, JavaScript and PHP programming. I am Wordpress theme and plugin developer. I am a father and husband living in Bangladesh.

You may also like

Leave a Reply