title: Using wordpress login functions
body: <p>Does anybody have any experience writing a custom Wordpress login page using the functions:</p>
  
  <pre><code>wp_signon()
  and wp_set_auth_cookie()
  </code></pre>
  
  <p>found on <a href="http://codex.wordpress.org/Function_Reference/" rel="nofollow noreferrer">http://codex.wordpress.org/Function_Reference/</a></p>
  
  <p>I can't seem to get them working.</p>
  
  <p>The code looks something like this:</p>
  
  <pre><code>function login_wordpress($username, $password) {
      $creds = array();
      $creds['user_login'] = $username;
      $creds['user_password'] = $password;
      $creds['remember'] = true;
      $user = wp_signon( $creds, false );
      if ( is_wp_error($user) ) {
         echo $user-&gt;get_error_message();
         die();
      } else {
           wp_set_auth_cookie( $user, 0, 0);
      }
  }
  </code></pre>
  
  <p>Am I missing something basic?</p>