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 Parameters

$pass_change_email

(array) 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.

$user

(array) The original user array.

$userdata

(array) The updated user array.


Top ↑

Source Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
4.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by marginean.doru

    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;
    }
    
  2. Skip to note 2 content
    Contributed by 云落
    add_filter( 'password_change_email', '__return_false' );

    don’t send email when user change password

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