How to stay on the same page after login with social net script
-
Hello
This article is just hint for another users!
After logging by Google the plugin redirects me on main page of the site, so to stay on the same page next script will help:
//redirect after social login add_action('send_headers', function() { if (isset($_SERVER['HTTP_REFERER']) AND ! isset($_GET['redirection_done'])) { $ref = $_SERVER['HTTP_REFERER']; if (!empty($ref)) { parse_str($ref, $query_parts); unset($_SERVER['HTTP_REFERER']); if (isset($query_parts['redirect_to']) AND ! empty($query_parts['redirect_to'])) { if (substr_count($query_parts['redirect_to'], '?')) { wp_redirect($query_parts['redirect_to'] . '&redirection_done=1', 302); } else { wp_redirect($query_parts['redirect_to'] . '?redirection_done=1', 302); } } } } }, 0);
Drop it in functions.php of current wp theme
- The topic ‘How to stay on the same page after login with social net script’ is closed to new replies.