From 372c7476b26d1ddb7d4182fdd51b04dd875439ad Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Tue, 9 Nov 2021 23:47:59 +0000 Subject: [PATCH] Login and Registration: Pass `$errors` parameter to `registration_redirect` filter. On user registration, the `$errors` variable is the result of `register_new_user` which contains either the newly registered user's ID on success or a `WP_Error` object on failure. This change passes that context to the `registration_redirect` filter. Props Collizo4sky, aadilali, mukesh27, audrasjb. Fixes #53992. Built from https://develop.svn.wordpress.org/trunk@52091 git-svn-id: http://core.svn.wordpress.org/trunk@51683 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-login.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index b53b219a21..73bce36094 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52090'; +$wp_version = '5.9-alpha-52091'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-login.php b/wp-login.php index ccfd45f1ec..7dd2c19809 100644 --- a/wp-login.php +++ b/wp-login.php @@ -1040,10 +1040,13 @@ switch ( $action ) { * Filters the registration redirect URL. * * @since 3.0.0 + * @since 5.9.0 Added the `$errors` parameter. * - * @param string $registration_redirect The redirect destination URL. + * @param string $registration_redirect The redirect destination URL. + * @param int|WP_Error $errors User id if registration was successful, + * WP_Error object otherwise. */ - $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); + $redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors ); login_header( __( 'Registration Form' ), '

' . __( 'Register For This Site' ) . '

', $errors );