Back to previous page with Gianism
Gianism adds social login featrues to your WordPress’ login screen. Generally, many sites don’t expect well-informed person who knows “WordPress has login screen at /wp-login.php”.
User flow in site which requires login
In sites which require login, therefore sites which requires Gianism, users takes flow like below:
- User accesses a web page, but it requires “You must be logged in”.
- User wants to see the content, then click the link and go to WordPress login screen.
- Registration is annoying, so he/she clicks one of the social login buttons.
- Login completed.
- Redirected to somewhere in the site.
Well, this article focus on “what to do after login completed?” By default, Gianism redirects them to profile page. Some ways exist to customize this behavior.
gianism_redirect_to
filter hook controls where to redirect.- Specify where to redirect with function
wp_login_url
- Specify where to redirect with function
gianism_login
List 1( filter approach) doesn’t suite this case to redirect user to original page.
For example, if you have specially customized page like /my-page
and you want your users to be redirected always after logged in, filter approach works. Because filter hooks loses detailed context(e.g. where the user were before).
Thus, if you want your users to be redirected to original page, 2nd or 3rd of list helps.
Well, I will show you the example. To proceed, you have to be logged in!
Table Of Contents
- User flow in site which requires login
- Case 1: Use wp_login
- Case 2: Use gianism_login