Last active
January 1, 2020 06:54
-
-
Save meetawahab/84d09684a43b7fc7096667f6d5e4305c to your computer and use it in GitHub Desktop.
Redirect user to the referrer page after login to the WordPress site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'login_redirect', function ( $redirect_to, $requested_redirect_to, $user ) { | |
if ( ! $requested_redirect_to ) { | |
$redirect_to = wp_get_referer(); | |
} | |
return $redirect_to; | |
}, 10, 3 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment