WordPress admin locked? How to fix it fast?

WordPress admin locked
WordPress admin locked? Fix it fast

Have you tried accessing your WordPress dashboard only to be denied? Maybe you forgot your password, or perhaps a plugin is causing issues. Either way, it's irritating—a typical WordPress admin locked situation. Worry not, though. This guide will help you rapidly solve the issue.

Let's look at the most frequently mentioned causes and what you could do to get back to your administrative area.

1. How do you change your WordPress password?

  • The smooth fix is to restore your password
  • Enter your username or email address attached with your WordPress admin login details
  • WordPress will send an email with a link to reset your password
  • To establish a new password, click the link which you got in the email
  • Should that still not yield results, use a manual technique which will require more of a developer approach

2. Reset password using phpMyAdmin

To reset your password using phpMyAdmin method, please follow the steps as explained here:

  • Access your hosting control panel—cPanel (Like Hostinger, GoDaddy, NameCheap, or any other you know)
  • Click on phpMyAdmin settings
  • Find and reach your WordPress database name, you can find it in wp-config.php file in your WordPress directory
  • Access the table named wp_users.
  • Find your username, then select Edit.
  • Choose MD5 from the dropdown to encrypt it.
  • Click Save.

Now return to your login screen and try the new password.

3. Using FTP, disconnect every plugin

  1. Sometimes, a plugin could harm the login page
  2. Try to access your website using File Manager, and log in through the FTP/SFTP hosting panel
  3. Explore the wp-content folder
  4. Rename the plugins folder to plugins_backup
  5. WordPress will now disable every plugin
  6. Try checking in once more. Rename the folder back if all went well, and activate each plugin one by one. 

4. Change to a usual WordPress design

WordPress themes can also lead to admin locked situation, particularly following changes may cause this issue more frequently. Here's how to modify to a corrupted theme:

  • Use File Manager or FTP to access your site.
  • Access the /wp-content/themes/ folder.
  • Rename the folder of your active theme.
  • Now, WordPress will use a theme similar to Twenty Twenty-Four.
  • Access your dashboard once more. It should work properly.

5. Using tasks.php, I established a new admin user

Should none of the aforementioned techniques succeed, use code to set up a new admin user. Here is what to do:

  • Access the folder of your current theme using FTP.
  • Access the tasks.php file.
  • Add this code at the bottom:
     
<?php
require_once('wp-load.php');
$username = 'newadmin';
$password = 'StrongPassword123!';
$email    = 'admin@example.com';
if (!username_exists($username) && !email_exists($email)) {
   $user_id = wp_create_user($username, $password, $email);
   $user = new WP_User($user_id);
   $user->set_role('administrator');
   echo "Admin user created.";
} else {
   echo "User already exists.";
}
?>

  • Visit your website and save the file.
  • Log in using your updated credentials.
  • Once logged in, delete the code from functions.php to safeguard your site.

6. Clear Cookies and Browser Cache

  • The browser cache should be cleared.
  • Cookies for your domain should be deleted.
  • Restart your browser and see what logging in once more yields.

7. Look for file permission problems

Using FTP, visit the main directory of your site.

  • Ensure folders have 755 access permissions.
  • Ensure files have permission 644.
  • Should you have any questions, get in touch with your hosting company for assistance.

8. Contact your web host

Should everything else fail, it's time to seek help. Most hosting companies also provide support around the clock. They might:

  • Review server logs.
  • Resolve any database or permission problems.
  • Describe your issue precisely, and they will help you navigate the solution.

You may also like to read: 

You might also want to check out our guide on Fixing WordPress White Screen, which many users face alongside this one.

Final Observations

 Usually, though, it's quite simple to correct.

Begin with a password reset. Should that fail, explore phpMyAdmin, FTP, or theme modifications. The secret is to remain composed and go through each stage.

  • Once you are back in, think about enhancing the security of your website:
  • Create a robust password.
  • Maintain theme and plugin updates.
  • Add a security plugin—Wordfence or Sucuri
  • This approach lowers your odds of getting locked out once more.

If you are still not able to fix this problem, contact our wordpress developer to get instant  & professional support to make your Wordpress website keep working fine without any technical error.

Related Solutions