WordPress : Website for logged in users only

If you want to hide your wordpress website, so that, only logged in users may access it. So, here’s the quick fix.

append following code into your wp-blog-header.php file right below wp();

//****************************************************//        
/////////////////////////// Require login to view website
get_currentuserinfo();
global $user_ID;
if ($user_ID == '')
{
        header('Location: wp-login.php');
}
////////////////////////// Require login to view website
//*****************************************************//

Thats it. Simple enough ?


Comments

Leave a Reply

%d bloggers like this: