How to Login Redirect with Plugin on WordPress?

Michael Oldborn

How to Login Redirect with Plugin on WordPress?


Characterize a lot of divert rules for explicit clients, clients with explicit jobs, clients with explicit capacities, and a sweeping guideline for every single other client. Likewise, set a divert URL for post-enlistment. This is altogether overseen in Settings > Login/logout diverts.

You can utilize the sentence structure [variable]username[/variable] in your URLs so the framework will fabricate a unique URL upon each login, supplanting that content with the client’s username. Notwithstanding username, there is “userslug”, “homeurl”, “siteurl”, “postid-23”, “http_referer” and you can likewise include your own custom URL “factors”. See Other Notes/How to Extend for documentation.

In case you’re utilizing a module, for example, Gigya that sidesteps the normal WordPress login divert process (and just permits one fixed divert URL), set that module to divert to wp-content/modules/subsides login-divert/wplogin_redirect_control.php and set the applicable setting to “Yes” at the base of the Settings > Login/Logout diverts page in the WordPress administrator board.

You can include your own code rationale previously and between any of the module’s ordinary divert checks if necessary. See Other Notes/How to Extend for documentation. A few models include: diverting the client dependent on their IP address; and divert clients to an exceptional page on first login.

This module likewise incorporates a capacity rul_register that demonstrations equivalent to the wp_register work you find in layouts (ordinarily delivering the Register or Site Admin connects in the sidebar), then again, actually it will restore the exceptionally characterized administrator address. rul_register takes three parameters: the “previously” code (as a matter of course “<li>”), the “after” code (as a matter of course “</li>”), and whether to reverberate or restore the outcome (default is valid and along these lines reverberation).

You can review the video

Play Video



You can compose your own code rationale before any of this present module’s checks for client explicit, job explicit, and ability explicit sidetracks, just as before the fallback divert URL.

Accessible channels are:

  • rul_before_user
  • rul_before_role
  • rul_before_capability
  • rul_before_fallback

Each takes the same 4 parameters:

  • $custom_redirect_to: This is set as false in case you don’t have any redirect URL to set. Return this instead of false in case you have multiple filters running.
  • $redirect_to: Set by WordPress, usually the admin URL.
  • $requested_redirect_to: Set by WordPress, usually an override set in a GET parameter.
  • $user: A PHP object representing the current user.


Your return value in your own code logic should be the URL to redirect to, or $custom_redirect_to to continue the plugin’s normal checks.

6 thoughts on “How to Login Redirect with Plugin on WordPress?

Leave a Reply

Your email address will not be published. Required fields are marked *