Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. function login_init () {
  2. $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
  3.  
  4. if ( isset( $_POST['wp-submit'] ) ) {
  5. $action = 'post-data';
  6. } else if ( isset( $_GET['reauth'] ) ) {
  7. $action = 'reauth';
  8. } else if ( isset($_GET['key']) ) {
  9. $action = 'resetpass-key';
  10. }
  11. else if ( isset($_GET['rp']) ) {
  12. $action = 'rp';
  13. }
  14.  
  15. if (
  16. $action == 'post-data' || // don't mess with POST requests
  17. $action == 'reauth' || // need to reauthorize
  18. $action == 'resetpass-key' || // password recovery
  19. $action == 'logout' // user is logging out
  20. ) {
  21. return;
  22. }
  23. if ( $action != 'rp' && $action != 'lostpassword') {
  24.  
  25. wp_redirect( home_url( '/login/' ) );
  26. exit;
  27. }
  28. }
  29. add_action('login_init', 'login_init');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement