This topic has 0 replies, 1 voice, and was last updated 11 years by SQadmin.

  • Author
  • #2107
     SQadmin
    Keymaster

    Add this code to redirect a user to the last visited page.
    File location: wp-content/themes/sweetdate-child/functions.php

    COPY CODE
    
    add_filter('login_redirect', 'redirect_previous_page', 10);
    function redirect_previous_page(){
        $request = $_SERVER["HTTP_REFERER"];
        $req = explode(get_option('siteurl'),$request);
        if (isset($req[1])){
            $redirect = site_url( $req[1], 'login_post' );
        } else {
            $redirect = site_url( '', 'login_post' );
        }
        return $redirect;
    }
    

    Note: Make sure to have the child theme activated

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?