Members only function, but allow account activation [solved]

I have small multisite and one of site is restricted. When you go site you will see login page first because this function:

function members_only() {
    global $pagenow;
    // Check to see if user in not logged in and not on the login page
    if( !is_user_logged_in()  $pagenow != 'wp-login.php' )
       auth_redirect();
    add_action( 'wp', 'members_only' ); 

Problem is when I add a new user in site and user gets activation link domain.com/wp-activate.php?key=abcde132456

... and they click it, they go straight to the login because of that function and the user account won't activate because wp-activate.php page wont show.

I would be thankful for the tricks. Maybe some if function only wp-activate.php site?

Topic members functions multisite Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.