可將網站自動更新
與redirect 新位置

迴上一頁的跳轉寫法

https://bhnknu.pixnet.net/blog/post/444371324-%E5%9B%9E%E4%B8%8A%E4%B8%80%E9%A0%81%E5%92%8C%E8%B7%B3%E8%BD%89%E7%B6%B2%E9%A0%81%E8%AA%9E%E6%B3%95

https://tonyatta.pixnet.net/blog/post/21617901

https://www.wibibi.com/info.php?tid=152

/**
* Redirect user after successful login.
*
* @param string $redirect_to URL to redirect to.
* @param string $request URL the user is coming from.
* @param object $user Logged user’s data.
* @return string
*/
function my_login_redirect( $redirect_to, $request, $user ) {
    //檢查是否有建置會員制度
    if (isset($user>roles) && is_array($user->roles)) {
        //確認是不是訂閱會員
        if (in_array(‘subscriber’, $user->roles)) {
            // 導向指定頁面,程式範例是導向首頁。
            $redirect_to =  home_url();
        }
    }
    return $redirect_to;
}
add_filter( ‘login_redirect’, ‘my_login_redirect’, 10, 3 );