Wordpress redirect non-logged-in visitors


/ Published in: PHP
Save to your folder(s)

Place at the top of your header.php to redirect visitors who are not logged-in to the Wordpress admin. I use this to redirect to a simple HTML 'coming soon' page while sites are in development.


Copy this code and paste it in your HTML
  1. <?php if (!is_user_logged_in()) { wp_redirect('http://mydomain.com/coming-soon.html', 302); } ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.