title: Wordpress redirect user if not logged in
body: <p>I'm using the following code in functions.php to redirect users who are not logged in, excluding if you are in wp-login.php.</p>
  
  <pre><code>if(!is_user_logged_in() &amp;&amp; $pagenow != 'wp-login.php') {
  wp_redirect( 'http://signup.mysite.com', 302 );
  }
  </code></pre>
  
  <p>However, I've installed a shopping cart plugin that uses a different login page and basically redirects mysite.com/wp-login.php to mysite.com/account/login.</p>
  
  <p>Is there some code I can use to exclude url paths from redirecting, perhaps something to replace <code>$pagenow != 'wp-login.php'</code>?</p>