All emails sent by a clean installation of WordPress go out with the sender name “WordPress” and the address “”.

Since it’s not so nice to receive emails from a site and see in the sender name “WordPress” it is usually a good choice to change it. I don’t know why WordPress doesn’t make this option available by default.

Anyway to change if you need to install a plugin, there is a wide choice, but if you want to just add few line of code to your blog, it is pretty easy:

add_filter('wp_mail_from_name', function ($from_name) {
  return "My Name"; 

The variable $from_name contains just “WordPress” and we ignore it.

Where to add such code?

You can add it directly in your functions.php theme file, specially if you have a child theme. But that make the code theme-dependent which is something I really don’t like. Changing the sender name for your emails is not something related to the theme!

The better alternative is to place a file with the code inside the wp-content/mu-plugins folder, which is the folder dedicated to the “must-use” (from which “mu”) plugins, so the snippet will be loaded every time without no need for other configurations.

Similar Posts

Leave a Reply