apply_filters( ‘password_change_email’, array $pass_change_email, array $user, array $userdata )

Filters the contents of the email sent when the user’s password is changed.

Parameters

$pass_change_emailarray
Used to build wp_mail() .
  • to string
    The intended recipients. Add emails in a comma separated string.
  • subject string
    The subject of the email.
  • message string
    The content of the email.
    The following strings have a special meaning and will get replaced dynamically:
    • ###USERNAME### The current user’s username.
    • ###ADMIN_EMAIL### The admin email in case this was unexpected.
    • ###EMAIL### The user’s email address.
    • ###SITENAME### The name of the site.
    • ###SITEURL### The URL to the site.
  • headers string
    Headers. Add headers in a newline (rn) separated string.
$userarray
The original user array.
$userdataarray
The updated user array.

Source

$pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata );

Changelog

VersionDescription
4.3.0Introduced.

User Contributed Notes

  1. Skip to note 3 content

    Use the code below if you don’t wish to show your real administrator email inside password change notifications.

    Change ‘other_email@your-domain.com’ to the new email address.

    /**
     * Change admin email in notifications.
     *
     * This applies to password change notifications.
     *
     * @param (array) $pass_change_email Used to build wp_mail().
     * @param (array) The original user array.
     * @param (array) The updated user array.
     *
     * @return (array) $pass_change_email Updated wp_mail() content.
     */
    add_filter('password_change_email', 'replace_admin_email_in_notification_emails', 10, 3);
    
    function replace_admin_email_in_notification_emails( $pass_change_email, $user, $userdata ) {
      $pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', 'other_email@your-domain.com', $pass_change_email['message'] );
    
      return $pass_change_email;
    }

You must log in before being able to contribute a note or feedback.