2014-10-01 35 views

回答

1
wp_redirect($location, $status); 
exit; 

或嘗試這樣

wp_redirect(home_url('/custom/')); 
exit(); 
+0

我應該在哪裏放置這段代碼? – Resolution 2014-10-01 10:32:23

1

最簡單的方法可能是在您的webroot directory中創建一個.htaccess文件。

後來寫了進去:

Redirect /wp-admin http://www.example.com/custom 

相當自我解釋。 Redirect從第一鏈接/wp-admin到第二鏈路http://www.example.com/custom

另一種方法很可能是使用WordPress wp_redirect()功能,這樣的事情:

wp_redirect('http://example.com/custom', $status); 
+0

我應該在哪裏放置'wp_redirect('http://example.com/custom',$ status);'? – Resolution 2014-10-01 10:35:32

+0

@ wp-login.php內的分辨率 – Xatenev 2014-10-01 11:01:47

1

使用下面你的functions.php文件重定向到另一個代碼URL。

function redirect_login_page(){ 

// Store for checking if this page equals wp-login.php 
$page_viewed = basename($_SERVER['REQUEST_URI']); 

// Where we want them to go 
$login_page = http://example.com/custom; //Write your site URL here. 
// Two things happen here, we make sure we are on the login page 
// and we also make sure that the request isn't coming from a form 
// this ensures that our scripts & users can still log in and out. 
if($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') { 

// And away they go... 
    wp_redirect($login_page); 
    exit(); 

} 
} 

add_action('init','redirect_login_page'); 
+0

我應該在哪裏放置這段代碼? – Resolution 2014-10-01 10:32:07

+0

答覆編輯.. – 2014-10-01 10:40:56

相關問題