DEV Community

Kashif Raza
Kashif Raza

Posted on

WordPress: Change Sender Name and Email Address from wp

This code simply replaces the default WordPress sender name and email address with your custom sender name and email address.

You can test this by adding a new user, changing password, or any other action that sends WordPress notification email.

// Function to change email address

function wpb_sender_email( $original_email_address ) {
return 'tim.smith@example.com';
}

// Function to change sender name
function wpb_sender_name( $original_email_from ) {
return 'Tim Smith';
}

// Hooking up our functions to WordPress filters
add_filter( 'wp_mail_from', 'wpb_sender_email' );
add_filter( 'wp_mail_from_name', 'wpb_sender_name' );

Top comments (0)