• Resolved mohamaddapper

    (@mohamaddapper)


    Hi
    Is there any way to redirect users to previous page after login?

    I used this code but for premium content after login it redirects to home url.

    for example if I want to read a post it’s required to be logged in and after that it redirects me to home, not to the page i was looking for.

    function ag_rcp_login_form_redirect_to_previous( $output, $pairs, $atts, $shortcode ) {
    
    	$referer = wp_get_referer();
    
    	if ( ! empty( $referer ) ) {
    		$output['redirect'] = $referer;
    	}
    
    	return $output;
    
    }
    add_filter( 'shortcode_atts_login_form', 'ag_rcp_login_form_redirect_to_previous', 10, 4 );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect to previous page after login’ is closed to new replies.