Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter esther0708

    (@esther0708)

    We have also deleted and readded them in. Did not work either

    Hi @esther0708,

    First, verify that the administrator accounts have the correct user roles. Access your site’s database via phpMyAdmin, navigate to the wp_usermeta table, and check the wp_capabilities entry for the affected users. Ensure the value is a:1:{s:13:"administrator";b:1;}. If it’s different, update it accordingly.

    Next, manually reset the passwords through phpMyAdmin. In the wp_users table, locate the user, edit the user_pass field, enter a new password, and select MD5 from the function dropdown before saving. This method is detailed in the WPBeginner guide on resetting a WordPress password from phpMyAdmin.

    Should the problem persist, consider creating a new administrator account by adding a function to your theme’s functions.php file. Insert the following code:

    function add_admin_account(){
        $user = 'newadmin';
        $pass = 'StrongPassword123!';
        $email = 'admin@example.com';
        if ( !username_exists( $user ) && !email_exists( $email ) ) {
            $user_id = wp_create_user( $user, $pass, $email );
            $user = new WP_User( $user_id );
            $user->set_role( 'administrator' );
        }
    }
    add_action('init','add_admin_account');

    After logging in with the new account, remember to remove this code from functions.php.

    Give it a try, and let me know how that goes! 😄

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Admin Users cannot login’ is closed to new replies.