1

I used this code for changing the email sender name from Wordpress to my own title.

function wpb_sender_email($original_email_address)
{
    return 'info@mydomain.com';
}

// Function to change sender name
function wpb_sender_name($original_email_from)
{
    return 'mydomain.com';
}

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

But it just changes welcome emails. when a user wants to change his/her email, the email notification send by WordPress@mydomain.com So how can I change it too?

2

As of version 4.9 there is a dubious "feature" that prevents you from changing the site email without a confirmation email going out, and the admin confirming his own change. Those filters, as you've discovered, won't work.

For instance, from now on, if you're using WordPress for an IOT device or on localhost, it's impossible for an admin to change the site admin address on a single site.

You'll have to remove the new hooks, and plop in your own. I put a plugin on the .org repo that does this. You can use that and just put your own values in. https://wordpress.org/plugins/change-admin-email-setting-without-outbound-email/

Here is the code on Github: https://github.com/JohnDeeBDD/change-admin-email/blob/master/change-admin-email.php

  • thanks. and is there any code for putting on function. without installing the plugin? – joei Aug 2 '18 at 12:31
0

Paste this below code your current active functions.php file

function custom_wp_mail_from_name($from_name){
return “Custom Name”;
}

add_filter(“wp_mail_from_name”, “custom_wp_mail_from_name”);


function custom_wp_mail_from($email){
return “xxxxxx@example.com”;
}
add_filter(“wp_mail_from”, “custom_wp_mail_from”);
  • thanks but it does not work. and email and sender name do not change. – joei Aug 2 '18 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.