Hello Coders,
I am starting a new series of code snippets where I’ll be publishing all the code snippets to edit on WordPress core functionality by easily adding them to your function.php file
I have been getting lots of queries in the contact form for starting this.
By default, WordPress uses ‘WordPress’ as the sender name for all outgoing WordPress notification emails. This doesn’t look very professional, and you may want to change that to your business name.
So let’s begin with the first one today by simply changing the From Name of your emails that are going and the default email address of wordpress@yourdomainname.com
Change Sender Name and Email in WordPress
You’ll need to add the code in function.php
OR
You can also add it in the Code Snippets Plugin in case you have a custom development and do regular updates of your base theme
// Function to change email address - Replace the email with your desired one
function ite_sender_email( $original_email_address ) {
return 'hello@itedvantage.com';
}
// Function to change sender name - Change the name you wish to keep
function ite_sender_name( $original_email_from ) {
return 'Hemant Shah';
}
// Hooking up our functions to WordPress filters
add_filter( 'wp_mail_from', 'ite_sender_email' );
add_filter( 'wp_mail_from_name', 'ite_sender_name' );
Hope it helps you and kindly share your feedback in the comments.
Get in touch for more code snippets.
1 Comment