From 68d8954313e3f9b878979729a319d9f9a2d9e0a1 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 19 Nov 2008 05:07:24 +0000 Subject: [PATCH] Do not redirect to options.php on login if user was POSTing to options.php from another page. props fitztrev. fixes #8133 git-svn-id: https://develop.svn.wordpress.org/trunk@9775 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/pluggable.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 41e8421f18..bffa214a31 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -760,7 +760,9 @@ function auth_redirect() { else $proto = 'http://'; - $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), 'login' ); + $redirect = ( strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ) ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + + $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( $redirect ), 'login' ); wp_redirect($login_url); exit();