Redirecting to the previous protected page after login

OK, I know there have been plenty of posts regarding this subject, but for some reason it’s still not working for me. When a user tries to access a protected page she gets redirected to the MOP page. After she signs in she’s supposed to be redirected back to the protected page. But she’s being sent to the Login Welcome Page. What am I doing wrong?

I’m using the s2member pro Login Widget and I set the “Redirection After Login” to “Previous Page”.
image

I also have set the s2Member>General Options> Login Welcome Page to the correct page.
image

And I’ve set up the Membership Options Page correctly
image

And finally I set up members to be redirected from the default Wordpress profile page.
image

Thank you

Hi Alto.

Yeah, it’s not exactly what you are trying to do… “Previous Page” on login would bring the person back to the page he logged in from. In your example that’d be the Membership Options Page, but what you’re trying is to get him back to the page that redirected him to the MOP page, right?

You need to get from the MOP vars the page that he tried to access, and then use that page’s address for the redirection after login. If you link to wp-login.php, for example, you’d add it to the query string as https://yoursite.com/wp-login.php?redirect_to=/the-protected-page, if I remember correctly.

See: https://s2member.com/kb-article/s2mop-shortcode/

I hope that helps. :slight_smile: