johnbillion / user-switching

WordPress plugin that provides instant switching between user accounts.
https://wordpress.org/plugins/user-switching/
GNU General Public License v2.0
187 stars 49 forks source link

Redirect to referrer URL #110

Closed wgstjf closed 11 months ago

wgstjf commented 11 months ago

Hi,

Hopefully a quick one. We'd like the User to be returned to the refererer URL where they clicked on the 'Switch To' link when the switch back. Is there a filter we can use to define/override the redirect url? Hoping to affect all instances of the 'Swtich To' link wherever it appears, ie. table, user edit screen or custom instances using maybe_switch_url.

Thanks in advance,

Will

johnbillion commented 11 months ago

Yes you can use the login_redirect filter for this, which also takes effect when a user manually logs in to WordPress.

Ref: https://wordpress.org/plugins/user-switching/#are%20any%20plugin%20actions%20called%20when%20a%20user%20switches%20account%3F