Contact Us

Table of Contents

  1. Why You Might Get Locked Out of WordPress

  2. Common Scenarios That Lock You Out

  3. Before You Begin: Backup Your Site

  4. Method 1: Recover WordPress Admin via phpMyAdmin (cPanel)

  5. Method 2: Create a New Admin Account via FTP

  6. Method 3: Reset Admin Password via Functions.php

  7. Method 4: Using WP-CLI to Restore Admin Access

  8. Method 5: Contact Hosting Provider Support

  9. How to Prevent Getting Locked Out Again

  10. Final Thoughts

Why You Might Get Locked Out of WordPress

Getting locked out of your WordPress admin dashboard can feel frustrating and scary — especially when you have no idea what went wrong. Thankfully, there are several ways to recover a locked WordPress admin account, even without access to the dashboard. If this method didn’t work for you, don’t stress — I can unlock your admin account safely.
👉 Emergency WordPress Support — Instant Fix

This article will guide you through proven, safe methods to restore admin access, whether you’re a beginner or a seasoned WordPress user.

Common Scenarios That Lock You Out

Understanding the reason helps you choose the best recovery method. Common causes include:

  • Incorrect password or username

  • Forgotten admin email

  • Plugin or theme conflicts

  • Hacked or compromised site

  • Changed user role accidentally

  • Disabled user account

  • White screen of death (WSOD)

  • Corrupted .htaccess or wp-config.php file

Before You Begin: Backup Your Site

Important: Before making any changes, always backup your WordPress site using your hosting panel or a backup plugin. If you’re unsure how to back up your website properly, check out our step-by-step guide on how to restore WordPress site from backup manually to ensure you can recover your site safely.

Method 1: Recover WordPress Admin via phpMyAdmin (cPanel)

If you have access to cPanel or phpMyAdmin, you can easily reset the admin password directly in the database.

Steps to Reset WordPress Admin via phpMyAdmin:

  1. Login to your cPanel.

  2. Open phpMyAdmin under “Databases”.

  3. Select your WordPress database.

  4. Click on the table wp_users.

  5. Find your admin username and click Edit.

  6. In the user_pass field, select MD5 in the Function column.

  7. Replace the value with your new password.

-- Example: Change password to 'MyNewSecurePassword123'
UPDATE `wp_users`
SET `user_pass` = MD5('MyNewSecurePassword123')
WHERE `user_login` = 'admin';
  1. Click Go to save changes.

  2. Log in with the new password.

Pro Tip: After login, consider changing your password again through the dashboard, as MD5 is not the most secure hashing method.

Method 2: Create a New Admin Account via FTP

If your original admin account was deleted or corrupted, you can create a new one manually using FTP.

Steps to Add Admin via FTP:

  1. Connect to your site using FileZilla or another FTP client.

  2. Navigate to:
    /wp-content/themes/YOUR_THEME/functions.php

  3. Add the following code at the bottom of functions.php:

function wpthrill_temp_admin_account() {
$user = 'wpthrill_admin';
$pass = 'StrongPassword!123';
$email = 'admin@wpthrill.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’, ‘wpthrill_temp_admin_account’);
  1. Save the file and go to your site.

  2. Log in using the new credentials.

  3. Remove the code immediately from functions.php after login to avoid security risks.

Method 3: Reset Admin Password via Functions.php

If you don’t want to create a new account, just reset the password using the theme’s functions.php.

Steps:

  1. Connect via FTP or file manager.

  2. Edit /wp-content/themes/YOUR_THEME/functions.php

  3. Add this snippet:

function wpthrill_reset_admin_password() {
$user = get_user_by('login', 'admin');
if ($user) {
wp_set_password('NewSecurePass456!', $user->ID);
}
}
add_action('init', 'wpthrill_reset_admin_password');
  1. Save and refresh the home page.

  2. Log in and remove the code afterward.

Method 4: Using WP-CLI to Restore Admin Access

For advanced users or developers with SSH access, WP-CLI is the fastest method.

Steps to Reset Password with WP-CLI:

  1. Connect to your server via SSH.

  2. Run the following commands:

cd /path/to/wordpress
wp user list
  1. Find your admin ID or username, then:

wp user update admin --user_pass=StrongPass789!
  1. Log in with the new password.

Bonus: You can also create a new user:

wp user create wpthrill_admin admin@wpthrill.com --role=administrator --user_pass=StrongPassword789!

Method 5: Contact Hosting Provider Support

If nothing works, contact your hosting provider. Most reputable hosts offer 24/7 support and can help:

  • Restore backups

  • Reset credentials

  • Fix corrupted files

  • Check for malware

How to Prevent Getting Locked Out Again

To ensure this doesn’t happen in the future:

Use a Security Plugin

  • Install plugins like Wordfence or iThemes Security to monitor access attempts and limit logins. For a full list of reliable options, check out our guide on the best WordPress security plugins to protect your site from hacks, malware, and unauthorized logins.

Enable Two-Factor Authentication (2FA)

  • Add 2FA via plugins to make login more secure.

Keep a Backup Plugin Active

  • Use UpdraftPlus, Jetpack, or BlogVault to automate backups.

Keep Your Email & Admin Details Updated

  • Ensure your admin email is accessible and updated.

Final Thoughts

Getting locked out of WordPress isn’t the end of the world. Whether it’s due to a forgotten password, plugin issue, or hacker attack, you now know exactly how to recover a locked WordPress admin account using various methods.

At WPThrill, we aim to make WordPress easier for everyone. If you found this guide useful, share it and check out our other tutorials to level up your WordPress skills.

Need Help?

Still stuck? Contact our support team or drop a comment below. We’re happy to help you get back in.

Subscribe To Our Newsletter & Get Latest Updates.

Copyright @ 2025 WPThrill.com. All Rights Reserved.