i added the following code in the Header.php
<?php
if ( !is_user_logged_in() ){
?>
<meta http-equiv="REFRESH" content="0;url=<?php wp_login_url(); ?>">
<?php exit;
}
else {
}
to redirect a user who is not logged in to wp-login.php i didn't use wp_redirect as it was not working properly. code was working fine but some how today it is causing infinity loop. i have placed the code in header.php and i don't think wp-login.php calls header.php can some one tell me what's the problem here or any other suggestion thanks