[wp-trac] [WordPress Trac] #65402: Introduce a filter to control whether the site administrator receives the password change notification email sent by wp_password_change_notification()
WordPress Trac
noreply at wordpress.org
Thu Jun 4 07:44:33 UTC 2026
#65402: Introduce a filter to control whether the site administrator receives the
password change notification email sent by
wp_password_change_notification()
------------------------------------+-------------------------------------
Reporter: ibachal | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Login and Registration | Version: trunk
Severity: normal | Keywords: has-patch needs-testing
Focuses: |
------------------------------------+-------------------------------------
Problem:
The wp_password_change_notification() function sends an email notification
to the site administrator whenever a user's password is changed. While
WordPress provides filters for controlling and modifying new user-related
email notifications, there is currently no way to programmatically disable
the admin password change notification while retaining the rest of the
core functionality.
This limitation requires developers to replace or override core behavior
when they only need to suppress the notification in specific scenarios.
Proposed Solution:
Add a new filter within wp_password_change_notification():
{{{
function wp_password_change_notification( $user ) {
/**
* Filters whether the admin is notified of a user
changing password.
*
* @since 7.0
*
* @param bool $send Whether to send the email. Default
true.
* @param WP_User $user User object.
*/
$send_notification_to_admin = apply_filters(
'wp_send_password_change_notification_to_admin', true, $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' ) ) && true === $send_notification_to_admin ) {
}}}
This would allow plugins and site owners to selectively disable the
notification:
{{{
add_filter(
'wp_send_password_change_notification_to_admin',
'__return_false'
);
}}}
Benefits:
- Improves extensibility without changing existing behavior.
- Maintains backward compatibility by defaulting to true.
- Aligns with WordPress' existing pattern of providing filters for email
notifications.
- Eliminates the need for plugins to replace or duplicate core
functionality solely to suppress this email.
Patch:
A patch is attached for review and testing.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65402>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list