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.

git-svn-id: https://develop.svn.wordpress.org/trunk@52091 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2021-11-09 23:46:09 +00:00
parent 6815eb6f33
commit e0ba1258dc

View File

@ -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' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors );