wp_password_change_notification

The timeline below displays how wordpress function wp_password_change_notification has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Notifies the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    /*
     * Send a copy of password change notification to the admin,
     * but check to see if it's the admin whose password we're changing, and skip this.
     */
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        /* translators: %s: User name. */
        $message = sprintf(__('Password changed for user: %s'), $user->user_login) . "\r\n";
        /*
         * The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
         * We want to reverse this for the plain text arena of emails.
         */
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $wp_password_change_notification_email = array(
            'to' => get_option('admin_email'),
            /* translators: Password change notification email subject. %s: Site title. */
            'subject' => __('[%s] Password Changed'),
            'message' => $message,
            'headers' => '',
        );
        /**
         * Filters the contents of the password change notification email sent to the site admin.
         *
         * @since 4.9.0
         *
         * @param array   $wp_password_change_notification_email {
         *     Used to build wp_mail().
         *
         *     @type string $to      The intended recipient - site admin email address.
         *     @type string $subject The subject of the email.
         *     @type string $message The body of the email.
         *     @type string $headers The headers of the email.
         * }
         * @param WP_User $user     User object for user whose password was changed.
         * @param string  $blogname The site title.
         */
        $wp_password_change_notification_email = apply_filters('wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname);
        wp_mail($wp_password_change_notification_email['to'], wp_specialchars_decode(sprintf($wp_password_change_notification_email['subject'], $blogname)), $wp_password_change_notification_email['message'], $wp_password_change_notification_email['headers']);
    }
}

WordPress Version: 6.1

/**
 * Notifies the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    // Send a copy of password change notification to the admin,
    // but check to see if it's the admin whose password we're changing, and skip this.
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        /* translators: %s: User name. */
        $message = sprintf(__('Password changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
        // We want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $wp_password_change_notification_email = array(
            'to' => get_option('admin_email'),
            /* translators: Password change notification email subject. %s: Site title. */
            'subject' => __('[%s] Password Changed'),
            'message' => $message,
            'headers' => '',
        );
        /**
         * Filters the contents of the password change notification email sent to the site admin.
         *
         * @since 4.9.0
         *
         * @param array   $wp_password_change_notification_email {
         *     Used to build wp_mail().
         *
         *     @type string $to      The intended recipient - site admin email address.
         *     @type string $subject The subject of the email.
         *     @type string $message The body of the email.
         *     @type string $headers The headers of the email.
         * }
         * @param WP_User $user     User object for user whose password was changed.
         * @param string  $blogname The site title.
         */
        $wp_password_change_notification_email = apply_filters('wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname);
        wp_mail($wp_password_change_notification_email['to'], wp_specialchars_decode(sprintf($wp_password_change_notification_email['subject'], $blogname)), $wp_password_change_notification_email['message'], $wp_password_change_notification_email['headers']);
    }
}

WordPress Version: 5.4

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    // Send a copy of password change notification to the admin,
    // but check to see if it's the admin whose password we're changing, and skip this.
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        /* translators: %s: User name. */
        $message = sprintf(__('Password changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
        // We want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $wp_password_change_notification_email = array(
            'to' => get_option('admin_email'),
            /* translators: Password change notification email subject. %s: Site title. */
            'subject' => __('[%s] Password Changed'),
            'message' => $message,
            'headers' => '',
        );
        /**
         * Filters the contents of the password change notification email sent to the site admin.
         *
         * @since 4.9.0
         *
         * @param array   $wp_password_change_notification_email {
         *     Used to build wp_mail().
         *
         *     @type string $to      The intended recipient - site admin email address.
         *     @type string $subject The subject of the email.
         *     @type string $message The body of the email.
         *     @type string $headers The headers of the email.
         * }
         * @param WP_User $user     User object for user whose password was changed.
         * @param string  $blogname The site title.
         */
        $wp_password_change_notification_email = apply_filters('wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname);
        wp_mail($wp_password_change_notification_email['to'], wp_specialchars_decode(sprintf($wp_password_change_notification_email['subject'], $blogname)), $wp_password_change_notification_email['message'], $wp_password_change_notification_email['headers']);
    }
}

WordPress Version: 5.3

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        /* translators: %s: User name. */
        $message = sprintf(__('Password changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $wp_password_change_notification_email = array(
            'to' => get_option('admin_email'),
            /* translators: Password change notification email subject. %s: Site title. */
            'subject' => __('[%s] Password Changed'),
            'message' => $message,
            'headers' => '',
        );
        /**
         * Filters the contents of the password change notification email sent to the site admin.
         *
         * @since 4.9.0
         *
         * @param array   $wp_password_change_notification_email {
         *     Used to build wp_mail().
         *
         *     @type string $to      The intended recipient - site admin email address.
         *     @type string $subject The subject of the email.
         *     @type string $message The body of the email.
         *     @type string $headers The headers of the email.
         * }
         * @param WP_User $user     User object for user whose password was changed.
         * @param string  $blogname The site title.
         */
        $wp_password_change_notification_email = apply_filters('wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname);
        wp_mail($wp_password_change_notification_email['to'], wp_specialchars_decode(sprintf($wp_password_change_notification_email['subject'], $blogname)), $wp_password_change_notification_email['message'], $wp_password_change_notification_email['headers']);
    }
}

WordPress Version: 4.9

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        /* translators: %s: user name */
        $message = sprintf(__('Password changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $wp_password_change_notification_email = array(
            'to' => get_option('admin_email'),
            /* translators: Password change notification email subject. %s: Site title */
            'subject' => __('[%s] Password Changed'),
            'message' => $message,
            'headers' => '',
        );
        /**
         * Filters the contents of the password change notification email sent to the site admin.
         *
         * @since 4.9.0
         *
         * @param array   $wp_password_change_notification_email {
         *     Used to build wp_mail().
         *
         *     @type string $to      The intended recipient - site admin email address.
         *     @type string $subject The subject of the email.
         *     @type string $message The body of the email.
         *     @type string $headers The headers of the email.
         * }
         * @param WP_User $user     User object for user whose password was changed.
         * @param string  $blogname The site title.
         */
        $wp_password_change_notification_email = apply_filters('wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname);
        wp_mail($wp_password_change_notification_email['to'], wp_specialchars_decode(sprintf($wp_password_change_notification_email['subject'], $blogname)), $wp_password_change_notification_email['message'], $wp_password_change_notification_email['headers']);
    }
}

WordPress Version: 4.6

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        /* translators: %s: user name */
        $message = sprintf(__('Password changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        /* translators: %s: site title */
        wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Changed'), $blogname), $message);
    }
}

WordPress Version: 4.4

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param WP_User $user User object.
 */
function wp_password_change_notification($user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
    }
}

WordPress Version: 3.9

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7.0
 *
 * @param object $user User Object
 */
function wp_password_change_notification(&$user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
    }
}

WordPress Version: 3.8

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7
 *
 * @param object $user User Object
 */
function wp_password_change_notification(&$user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
        $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
    }
}

WordPress Version: 3.7

/**
 * Notify the blog admin of a user changing password, normally via email.
 *
 * @since 2.7
 *
 * @param object $user User Object
 */
function wp_password_change_notification(&$user)
{
    // send a copy of password change notification to the admin
    // but check to see if it's the admin whose password we're changing, and skip this
    if ($user->user_email != get_option('admin_email')) {
        $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
    }
}