title: Wordpress capabilities and current_user_can() in functions.php
body: <p>I have added a function to functions.php to redirect users to posts-new.php after login and it works. However, I only want this to happen if the user logging in is a contributor. So I added the following:</p>
  
  <pre><code>/** Redirect after login */
      function mysite_login_redirect(){
          if ( current_user_can( 'manage_options' ) ) {
             return 'http://mysite.com/wp-admin/index.php';}
          else {
             return 'http://mysite.com/wp-admin/post-new.php';}
      }
  add_action( 'login_redirect', 'mysite_login_redirect');
  </code></pre>
  
  <p>In this state, both contributors and admins are redirected to post-new.php. To test it I modified the function so that users without the capability would be redirected: </p>
  
  <pre><code>if ( !current_user_can( 'ma ...
  </code></pre>
  
  <p>when I modified the function, both contributors and admins are redirected to index.php.</p>
  
  <p>So the function seems to work but this implies to me that it's not seeing the 'manage_options' capability for admins. I've tried several admin-exclusive capabilities with the same results. Weird huh?</p>
  
  <p>I should say that I am using the user role-editor-plugin but I disabled it and tested the functions with the same results.</p>
  
  <p>I'm also using Active Directory Integration and Admin Menu Editor. </p>