title: WordPress Login redirect_to not working
body: <p>I'm working on a web site with WordPress 3.7.1 and trying to redirect a user upon login via the redirect_to URL parameter.</p>
  
  <p>I've verified that the login form backend sees the redirect_to GET parameter, and that the login submission includes the redirect_to POST value...but thats where things don't work.</p>
  
  <p><strong>Removed link and user credentials</strong></p>
  
  <p>Upon login (for both my Admin acct and the Subscriber acct provided in this post), the user is taken to the WP dashboard instead of the URL in the redirect_to parameter.</p>
  
  <p>I do have the allowed_redirect_hosts being set, with the following code in a custom plugin file (which is pretty much just this).</p>
  
  <pre><code>add_filter( 'allowed_redirect_hosts' , 'glue_allowed_redirect_hosts' , 10 );
  function glue_allowed_redirect_hosts($content){
      $content[] = 'app.realestategradschool.com';
      $content[] = 'dev-app.realestategradschool.com';
      $content[] = 'app.realestategradschool.local';
      return $content;
  }
  </code></pre>
  
  <p>I've disabled all other plugins in an attempt to troubleshoot this.</p>
  
  <p>Edit: I can't use login_redirect as I'm not looking to redirect ALL logins...only if the visitor is sent to the login page from a different site (using oAuth to log them in...oAuth works...just not the redirect)</p>
  
  <p>Edit: Working solution:</p>
  
  <pre><code>function glue_login_redirect($redirect_to,$request='',$user=null){
      //using $_REQUEST because when the login form is submitted the value is in the POST
      if(isset($_REQUEST['redirect_to'])){
          $redirect_to = $_REQUEST['redirect_to'];
      }
      return $redirect_to;
  }
  add_filter('login_redirect','glue_login_redirect',999);
  </code></pre>