Change Password notification text on mail

If I understand you correctly, then you only want to change the text of the mail. This you can do via the filter hook password_change_email. No need to redeclare the function, which you actually can’t do. Below you find an example on how to use the password_change_email filter to change your message text.

add_filter( 
  'password_change_email', 
  'wpse207879_change_password_mail_message', 
  10, 
  3 
);
function wpse207879_change_password_mail_message( 
  $pass_change_mail, 
  $user, 
  $userdata 
) {
  $new_message_txt = __( 'Some text ###USERNAME### more text
    even more text ###EMAIL### more text after more text
    last bit of text ###SITENAME###' );
  $pass_change_mail[ 'message' ] = $new_message_txt;
  return $pass_change_mail;
}

I’ve tested this and it works. Just to clarify, this applies to the use case, in which one changes and updates the password via the backend user management.

Leave a Comment