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:

  1. User accesses a web page, but it requires “You must be logged in”.
  2. User wants to see the content, then click the link and go to WordPress login screen.
  3. Registration is annoying, so he/she clicks one of the social login buttons.
  4. Login completed.
  5. 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.

  1. gianism_redirect_to filter hook controls where to redirect.
  2. Specify where to redirect with function wp_login_url
  3. 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!

This article is only for registered user. To continue reading another 56% of content, please login.

Table Of Contents