SOFT
SPRINT

softsprint.net
shop

Set custom name and email in WordPress service messages

It is often necessary to change the sender’s name and email address, which are displayed in WordPress sent emails, for example, password recovery email or receiving a WooCommerce order. If you do not define your individual values for the name or email, then WordPress will apply the default values provided by the hosting provider. Let’s agree, this type of message is not the best!

So, open functions.php file of your theme and add the following code:

1
2
3
4
5
6
7
8
9
10
11
12
<?php
function wpb_sender_email( $original_email_address ) {
    return '[email protected]';
}
// Function to change sender name
function wpb_sender_name( $original_email_from ) {
    return 'Your name';
}
// Hooking up our functions to WordPress filters 
add_filter( 'wp_mail_from', 'wpb_sender_email' );
add_filter( 'wp_mail_from_name', 'wpb_sender_name' );
?>

Thank you for reading 😉

CONTACT US
Cookies | Privacy Policy | Terms and ConditionsSoftSprint ©