Wordpress redirect to landing page if not logged in
<p>I'm using the following code in my functions.php file to redirect users who are not logged in to a particular landing page</p>

<pre><code>    &lt;?php
if(!is_user_logged_in()) {
    wp_redirect( 'http://www.mysite.com/landingpage', 301 ); exit;
}
</code></pre>

<p>The problem is I cannot access my wp-login or wp-admin anymore. Every url redirects to landingpage. Is there a way I can exclude certain urls from redirecting?</p>
