Question

I want to do in my wordpress site appears wp-login.php for guests in all site, not just in an article or something. How i could do that? Wich files i should modify?

Registered users and admin users can see the site, but guests not.

Thanks!

Was it helpful?

Solution

Ok i solved with this way:

        // Redirect guest users
    function login_redirect() {
        global $pagenow; 
        // If user is not loged in and not in the login page
        if(!is_user_logged_in() && $pagenow != 'wp-login.php')
              auth_redirect();
    }
    add_action( 'wp', 'login_redirect' );
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top