crinklebat
crinklebat

Reputation: 316

Editing the Wordpress "Notice of Email Change" email text

If I log in to Wordpress as an admin and change another user's email address, the following email is automatically sent to that user saying the following:

Hi [username], This notice confirms that your email was changed on [website]. If you did not change your email, please contact the Site Administrator at [admin email] This email has been sent to [user email] Regards, All at [website] [website url]

Is there a way to edit this message to say something else?

Upvotes: 5

Views: 3669

Answers (2)

Reda Hafez
Reda Hafez

Reputation: 1

Just edit below file from root directory located in /wp-includes/user.php line no. 2064 or search for 'Hi ###USERNAME###, and you will find the message body as below that you can customize it as you would like.

$email_change_text = __(
    'Hi ###USERNAME###,

This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###.

If you did not change your email, please contact the Site Administrator at
###ADMIN_EMAIL###

This email has been sent to ###EMAIL###

Regards,
All at ###SITENAME###
###SITEURL###'
                     );

Upvotes: 0

Christina
Christina

Reputation: 34652

You would use the email_change_email filter. Learn about this filter in the WordPress Codex. Also learn about it on hookr.io

Learn about adding filters here.

    /* Filter Email Change Email Text */

    function so43532474_custom_change_email_address_change( $email_change, $user, $userdata ) {

        $new_message_txt = __( 'Change the text here, use ###USERNAME###, ###ADMIN_EMAIL###, ###EMAIL###, ###SITENAME###, ###SITEURL### tags.' );

        $email_change[ 'message' ] = $new_message_txt;

        return $email_change;

    }
    add_filter( 'email_change_email', 'so43532474_custom_change_email_address_change', 10, 3 );

Upvotes: 7

Related Questions