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
This commit is contained in:
davidbaumwald 2021-11-09 23:47:59 +00:00
parent ac37144d96
commit 372c7476b2
2 changed files with 6 additions and 3 deletions

View File

@ -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.

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 );