How to change the email in WordPress

I don’t see a logical reason behind it, but WordPress is designed for sending emails from the address [email protected]r-website.com

Did you spent hours to search where in the settings it’s possible to change this address? Wasted time, there the address is hardcoded, you can’t easily change it!

There are 2 ways to change it:

  1. Install a plugin like this: https://wordpress.org/plugins/wp-change-default-email/
  2. Write a few lines inside the functions.php in the theme (better if it’s a child theme)

Since I try to avoid to install WordPress plugins, I chose option 2.

In functions.php, add this:

// change the email
function wpb_sender_email( $original_email_address ) {
    return '[email protected]';
}

// change the name
function wpb_sender_name( $original_email_from ) {
    return 'Your Name';
}

// Hook those functions to WP 
add_filter( 'wp_mail_from', 'wpb_sender_email' );
add_filter( 'wp_mail_from_name', 'wpb_sender_name' );