Changing WordPress Admin Email Settings

(for my notes, but useful information)

This code block will set the email name and address that is used by WordPress admininstrative emails, like password reset requests or other notifications. Change the values as shown; the ‘notes’ explain everything.

<?php

/* 
change the from name/email on all site emails
 based on http://premium.wpmudev.org/blog/wordpress-email-settings/
        - by Rick Hellewell, Cellarweb.com, 21 Jan 2015
        - Copyright (c) 2015 by Rick Hellewell, Cellarweb.com
        
    SETUP/INSTALLATION
        - change two variables for the name and email address to be used in site/admin emails
        - place this entire code in child theme functions.php
            - we do not recommend changing the functions.php file in your theme, as a theme
                update will eliminate this additional code
                
    NOTES:
        - note that the email address should be valid and match your site domain
            or emails may end up in the recipient's spam folder
        - the 'from-email' is set in the Options, General screen, and stored in the admin_email
            row in the options table
        - there is no corresponding field in the options table for 'from_name', so we use the
            wp_mail_from_name filter to add our 'from_name' value to be used in admin email, 
            rather than the default 'WordPress' that is built into the pluggable.php core file

*/
// --------------------------------------------------------------------------------------
$from_name = 'PUT YOUR NAME HERE';
$from_email = 'PUT THE EMAIL ADDRESS HERE';

function set_email_name($from_name) {
    return $from_name;
}
function set_email_email($from_email) {
    return $from_email;
}
    
    add_filter("wp_mail_from_name", "set_email_name",9);
    add_filter("wp_mail_from", "set_email_email",9);
// --------------------------------------------------------------------------------------

	

Leave a Reply

Name and email are required. Your email address will not be published.