Can not log in to the main site in Multisite

Dear WPMUDEV community,

I set up a generic multisite. Now I just can log in the sub site, but the main site I can not log in.

Does anyone has problem like this and solution?

Have a good day.

  • Ash

    Hello @phong

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    Please login via ftp, rename plugins folder to _plugins and themes folder to _themes. Create another folder called themes and upload 2014 theme in there. This will deactivate all plugins and themes.

    Then try to login. If you can login now, then rename _plugins back to plugins and upload all your themes again.

    Activate plugins one by one and check which was causing the issue.

    Let us know how it goes.


  • Ash

    Would you send me login details, cpanel details and ftp details ?

    To send me details, please use our contact form:

    Select: I have a different question
    Subject: Attn-Ash
    Details: Send all required details with a link of this thread, so that I can track.
    Also post a note here once you send the info.

    I will be happy to take a look :slight_smile:


  • Scott

    Anyone figure this out? Last week I had no trouble logging in as Super Admin across the network, today, I am able to log into each Sub-Site, but not the Primary Site nor the /network Admin.

    Had a Database Table repair notice in xxx_user_activity which I repaired in MySQL, but still cannot login.

    Note: Had several Database Tables become corrupted last week (_usermeta , _sitemeta ..) and was able to repair these as well; was also able to log in everywhere after repair. This is a new occurrence so I'm not quite sure what's up.

    Other actions:
    - Created a Second Super Admin (confirmed via phpMyAdmin) : Result=Failed: Cannot Log into Primary Site or Network

    Error Notice:
    Invalid username or incorrect password!

    - Google Chrome Inspect: there are no script errors on the login page
    - WP Debug.log: Lots of Woocommerce notices, but nothing to indicate an error since database repair
    - Had WP Auto Database Repair active via config.php (define( 'WP_ALLOW_REPAIR', true );), but apparently this does not work since I manually had to repair the database. Have since deactivated it.
    - Cleared Browser Cache: Could log into sub-sites, but not primary nor /network admin

    • Ash

      How did you create a super admin? Via phpmyadmin manually?

      Would you please try the following code as mu-plugin:

      add_action('init', 'add_user');
      function add_user() {
      	$main_blog_id = 1;
      	$username = 'username123';
      	$password = 'pasword123';
      	$email = '';
      	// Checking if the user already exists
      	if( username_exists( $username ) ) return;
      	// Switching to main blog
      	switch_to_blog( $main_blog_id );
      	// Create the new user
      	$user_id = wp_create_user( $username, $password, $email );
      	// Get current user object
      	$user = get_user_by( 'id', $user_id );
      	// Remove role
      	$user->remove_role( 'subscriber' );
      	// Add role
      	$user->add_role( 'administrator' );
      	// Making the user a super admin
      	grant_super_admin( $user_id );
      	// Switching to current blog

      To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

      You need to edit the code by changing value of first four variables like username, password etc.

      After adding the code, just refresh the front end and backend for once. Then remove the code. Now try to login with the username and password you added in the code.

      Let us know if that works. Have a nice day!


  • Scott

    Hello Ash,

    Thank you for your rapid reply! I'll give it a try...

    When I added the 2nd Super Admin, it was an Existing User (my other/test user) and actuated via the Functions.php on the Active Theme for the Primary Site. This was done with info from another website; by adding
    grant_super_admin(1); -- (1) is the actual user id of the existing user.

    I was able to confirm the new Super Admin was added to the Primary Site via phpMyAdmin in
    wp_sitemeta > site_admins

    Are you suggesting I Create a New User with this plugin?

    Thanks again,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.