diff --git a/wp-login.php b/wp-login.php index b378485965..512e3d1774 100644 --- a/wp-login.php +++ b/wp-login.php @@ -359,11 +359,8 @@ case 'logout' : check_admin_referer('log-out'); wp_logout(); - $redirect_to = 'wp-login.php?loggedout=true'; - if ( isset( $_REQUEST['redirect_to'] ) ) - $redirect_to = $_REQUEST['redirect_to']; - - wp_safe_redirect($redirect_to); + $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true'; + wp_safe_redirect( $redirect_to ); exit(); break; @@ -373,12 +370,14 @@ case 'retrievepassword' : if ( $http_post ) { $errors = retrieve_password(); if ( !is_wp_error($errors) ) { - wp_redirect('wp-login.php?checkemail=confirm'); + $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; + wp_safe_redirect( $redirect_to ); exit(); } } if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.')); + $redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' ); do_action('lost_password'); login_header(__('Lost Password'), '
', $errors); @@ -393,6 +392,7 @@ case 'retrievepassword' : + @@ -434,7 +434,7 @@ break; case 'register' : if ( is_multisite() ) { - // WPMU doesn't use this + // Multisite uses wp-signup.php wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) ); exit; } @@ -453,11 +453,13 @@ case 'register' : $user_email = $_POST['user_email']; $errors = register_new_user($user_login, $user_email); if ( !is_wp_error($errors) ) { - wp_redirect('wp-login.php?checkemail=registered'); + $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; + wp_safe_redirect( $redirect_to ); exit(); } } + $redirect_to = apply_filters( 'registration_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' ); login_header(__('Registration Form'), ' ', $errors); ?> @@ -473,6 +475,7 @@ case 'register' :