In wordpress I am trying to force user login first before see anything. Means I want my user to first login to view any single page, post or archive and only they can se FAQ page. I am trying with below code but problem is as soon as I loged in, its redirect me again to login page.
However my site structure would be like below and in same manner I want this code to work...
// Force user to login on welcome
function my_force_login() {
global $post;
if (is_single() || is_front_page() || is_page() && !is_page('login') && !is_user_logged_in()){
auth_redirect();
}
}
Welcomd-Login screen (like facebook) -Home page -Blog -About -contact -FAQ
So I want to allow visitor only can see Welcome Login screen and FAQ, contact page to view rest of the site I want to force them to login..
I need great help of you people.. Thanks a lot in advance..
I think you are missing a parenthesis:
Easy way
There's a plugin you can use for this. Private Only