redirect_to not Including Hashtag from URL
function after_login_redirect_to_destination(){ if (!is_user_logged_in() && !is_home()){ $redirect = home_url() . ‘/wp-login.php?redirect_to=’ . urlencode( $_SERVER[‘REQUEST_URI’] ); wp_redirect( $redirect ); exit; } } add_action( ‘wp’, ‘after_login_redirect_to_destination’, 3 ); the above sample code works and redirect to the login page and after successfull login it will redirect to home page. Whenever a non-logged in user try to access … Read more