diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index bd80946c0c..2931fd892c 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -2110,7 +2110,17 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) : // We want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); - if ( 'user' !== $notify ) { + /** + * Filters whether the admin is notified of a new user registration. + * + * @since 6.1.0 + * + * @param bool $send Whether to send the email. Default true. + * @param WP_User $user User object for new user. + */ + $send_notification_to_admin = apply_filters( 'wp_send_new_user_notification_to_admin', true, $user ); + + if ( 'user' !== $notify && true === $send_notification_to_admin ) { $switched_locale = switch_to_locale( get_locale() ); /* translators: %s: Site title. */ @@ -2158,8 +2168,18 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) : } } + /** + * Filters whether the user is notified of their new user registration. + * + * @since 6.1.0 + * + * @param bool $send Whether to send the email. Default true. + * @param WP_User $user User object for new user. + */ + $send_notification_to_user = apply_filters( 'wp_send_new_user_notification_to_user', true, $user ); + // `$deprecated` was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notification. - if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) { + if ( 'admin' === $notify || true !== $send_notification_to_user || ( empty( $deprecated ) && empty( $notify ) ) ) { return; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3fad10eef5..a5ba84fba1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53692'; +$wp_version = '6.1-alpha-53698'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.