title: wordpress frontend login and wp-admin not working right
body: <p>i did prevent all user are not admin from wp-admin with this code</p>
  
  <pre><code>add_action( 'init', 'blockusers_init' );
  function blockusers_init() {
  if ( is_admin() &amp;&amp; ! current_user_can( 'administrator' ) &amp;&amp;
  ! ( defined( 'DOING_AJAX' ) &amp;&amp; DOING_AJAX ) ) {
  wp_redirect( home_url() );
  exit();
  }
  }
  </code></pre>
  
  <p>and i created frontend login form with <code>wp_signon();</code> the problem is when i submit form in admin account it's successfully logged in but when trying access wp-admin it always return to home page url
  so what's wrong and how can i fix this problem
  my form</p>
  
  <pre><code>&lt;?php 
  if($_SERVER['REQUEST_METHOD'] == 'POST' &amp;&amp; isset($_POST['logingo']) &amp;&amp; $_POST['logingo']=='logingo'){
      global $user;
      $creds = array();
      $username = (isset($_POST['login_name'])) ? $_POST['login_name'] : '';
      $password = (isset($_POST['login_password'])) ? $_POST['login_password'] : '';
      $creds['user_login'] = $username;
      $creds['user_password'] =  $password;
      $creds['remember'] = true;
      $userid = wp_signon($creds,false);
      if(is_wp_error($user)){
          $proccess = '&lt;div class="error_msg"&gt;'.$user-&gt;get_error_message().'&lt;/div&gt;';
          $_SESSION['logged_errors'] = $proccess;
      }
      if(!is_wp_error($userid)){
          $_SESSION['logged_success'] = 'success message';
          wp_redirect(get_author_posts_url($userid-&gt;ID));
          exit();
      }
         }
          ?&gt;
          &lt;form action="" method="post"&gt;
              &lt;label class="login_name"&gt;
                  &lt;input type="text" value="" name="login_name" required /&gt;
              &lt;/label&gt;
              &lt;label class="user_password"&gt;
                  &lt;input type="password" name="login_password" required /&gt;
              &lt;/label&gt;
                 &lt;button type="submit" name="logingo" value="logingo"&gt;go&lt;/button&gt;
          &lt;/form&gt;
  </code></pre>