The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › Back End › This will redirects you to the same page after login
// This will redirect you to the same page after login
if ( (isset($_GET[‘action’]) && $_GET[‘action’] != ‘logout’) || (isset($_POST[‘login_location’]) && !empty($_POST[‘login_location’])) ) { add_filter(‘login_redirect’, ‘my_login_redirect’, 10, 3); function my_login_redirect() { $location = $_SERVER[‘HTTP_REFERER’]; wp_safe_redirect($location); exit(); } }