Your Dedicated Partner for All Things WordPress

WordPress Hacked: Can’t log in – How to Get Back Into the WordPress Admin

Table of Contents

WordPress hacked and can’t log in? You are at the right place; we are going to see the complete guide on how to get back into the WordPress admin panel when your website is hacked and you can’t get into the admin panel. There are many ways you can get back into the WordPress admin and use the website as it was.

Urgent WordPress Assistance

Facing a critical WordPress issue? Don’t panic. Our Emergency Service is here to swiftly resolve any urgent website problems.

We will see the complete tutorial that you can follow to get back the admin panel. Further, we will see the method to clean your WordPress website and protect it from the attackers.

Some common fixes

First, we will see some of the most common fixes that you can use and it can solve the problem. Sometimes, your website isn’t hacked but you are just facing some small problems due to which you are unable to log in to the system. So, you can use the most common fixes given here that will work for some of the people.

  • Clear your computer cache and cookies. You can try incognito mode to check or you can simply clear the history/cache/cookies and try logging again.
  • The next method will be to update your .htaccess file. You can head over to file manager or FTP and look for .htaccess file. If you are a file manager, you can go to settings and click on “Show hidden files”. It will no show the hidden files where you can see the .htaccess file. Take a backup of that file and then delete it. Try logging into your WordPress panel again. If you succeed, you can simply go to Settings > Permalinks and just click the save button without making the changes. It will regenerate the .htaccess file. However, if you don’t succeed, make sure you restore the original file.
  • Hit the forgot password button and get your password. If your WordPress is hacked, you won’t be able to do it. Also, it could be because the hosting provider has disabled wp_mail() function. Also, sometimes when your website is compromised, your email address is changed. So, you need to get it back.

Now, if none of this work, the rest of the guide is for you.

Restore from the backup

The first and the easiest thing you can do to get the admin access is back to restore your website from the most recent backup. This would work perfectly well if your website isn’t updated since the last automatic or manual backup. That’s the primary reason you should take regular backups of your website.

If you already have a backup, you can simply restore the backup. It will rollback all the changes you made after the backup. So, make sure that you haven’t made any big changes.

However, if you don’t have the backup of the latest version of the website, you can carry on with one of the below-given methods. All the other methods will help you to fix WordPress’s hacked website and you can then log in to admin easily. We have a couple of methods from which you can try one.

If you succeed in restoring the backup, make sure you scan the website for the vulnerabilities. You can head over to the last section of this guide.

Softaculous password change

Most of the people have installed WordPress using Softaculous. It is a site software that comes inside of cPanel. It is a widely popular tool that everyone is using. If you installed WordPress using Softaculous, you can easily reset it. Softaculous makes it extremely easy for you to reset the password.

Even if the attacker has changed the email address of the admin panel, you can still reset it. All ou need to do is open your cPanel account and read over to the Softaculuos option. When you open it, you will see the site scripts. You don’t need to do is see in the top bar. There will be various options there. You will need to head over to the first option that is “All installations”. When you go in the all installations tab, you will see all the WordPress and other website installations. Now, you will have to find a website that is hacked. Besides, you will see the edit option. It’s usually the one with a pen or pencil icon. You can click on it and it will take you to a new page.

In the new page, you can change all the details of your WordPress installation. Here, you will have to change the password and the email address of the admin. You can also try changing the username. Once you do it, try to log in again. If you don’t succeed, you can proceed to the next step. Many times, this method doesn’t work, so there is nothing to worry about, we will see the new method using which you can do the same thing.

Change email using PhpMyAdmin

Now, let’s see another method where we will change the email address from the database. It helps you to reset the email address and then you can click on the forgot password to get the password in your respective email address.

First of all, you will need to open your cPanel. From there, you need to head over to PhpMyAdmin. In the same way, if your hosting provider doesn’t provider cPanel, you can open PhpMyAdmin from your respective panel. Once you are there, you will have to open your WordPress database. If you don’t know which one is your WordPress database, you can go to Softaculous and see the name of the database.

Instant WordPress Support

Get immediate assistance for your WordPress website with our on-demand support services.

You will have to back up your database before you make the changes. Once you are there in the database, you will have to click on the export button at the top bar. If you don’t see it, you can click on the More button and then go to export. It will then ask you to select an extension. You can select SQL and hit the export button.

Now, you can find the users table. Usually, it is the table with the name wp_users. When you will see some of the usernames in one of the columns, click on the edit button on the respective row.

From there, you will have to find the email field and change the email address to your working one. Now, you can click on the GO button. If it shows a success message, you are good to go.

Now, you can head back to yourdomain.com/wp-admin and click on forgot password. It will send an email to the email you entered.

Change password with PhpMyAdmin

Now, we will see the procedure to change the password with PhpMyAdmin. Just like we changed the email address, we can also change the password using PhpMyAdmin. It is highly recommended that you read the previous section of changing email addresses with PhpMyAdmin as we are going to do some of the same procedures here. Therefore, it would be easier for you to do the process if you read the above section.

You will first have to backup your database just like we did in the previous section. Now, you can head over to the WordPress database and open the wp_users table.

Inside it, you will have to find the row with your username. If you can’t find one, you can select any row with the admin username and click on the edit button.

Inside it, you will head over to the password row. It will be the field with the name user_pass. You will see some huge text written over there. Now, you will have to first select “MD5” from the functions column. It will be in the dropdown. Once you select it, you can type the new password in the “Value” field. Click on the “Go” button and you have successfully changed the password of the admin user.

You can then login to your WordPress panel with the new password and make the necessary changes. Make sure you remove all the extra users from there. You can also scan the website for malware and virus. We will see more about it later on.

Before that, we will cover one more problem that many people are facing.

Change user from subscribers to admin

Sometimes, you will succeed in changing the password. However, you won’t have admin access to the WordPress website. You would only be using WordPress as a subscriber. So, your next job will be to change the user to admin. This section will guide you in doing the same thing easily.

You will have to first open your database and open the wp_users table. You will see the username in one of the columns. See the “ID” of the username whom you want to make an admin.

For example, if your username is “mike”, you will have to see the user id of mike. Let’s say it is 12, you will have note it down or you can simply copy it.

Now, you will have to go to the wp_usermeta table. Inside it, you will see the “user_id” column. Find the row with the ID that you found above (in our case, we had 12, so we will look for the row which has “user_id” 12). Hit the edit button and select the meta_key to wp_capabilities from the drop-down menu. In the meta_value field, you will have to paste the below-given code.

a:1:{s:13:”administrator”;s:1:”1″;}

Click on the “Go” button and you are good to go. You have now successfully changed the user status from subscriber to administrator. You can now log in and access the admin panel.

If you don’t want to do all of these, you can also change the password of all the users and try each of them one by one. It works smoothly if you have few users.

For instance, if you just have 3 users, it would be easier to change the password of all the three users and see who is the admin of the website rather than doing this thing.

Scan the website

Once you have got the admin panel back and can log in to admin, your next job will be to scan the website for vulnerabilities and clean it.

So, you can follow these steps to scan and clean the website easily.

  • Install a security plugin such as Sucuri or iThemes security and scan the entire website for viruses and malware.
  • Note down the infected files and fix the code that can be fixed with the help of a plugin
  • Use cPanel’s virus scanner to run a scan of the entire website. List the infected files.
  • Now, you will either have to replace the infected files with the fresh files or you can check the file manually and remove the encrypted code.
  • To replace the file, you can head over to the official plugin/theme page and download a new copy. Thereafter, you can replace the infected files with the fresh one that you found on the list.
  • If it is the core files, you can head over to Dashboard > Updates and reinstall WordPress from there.
  • To scan the files manually, look for manual code or encrypted code in each of the files. Remove that code and you are good to go.
  • Rescan the website to be sure that there are no more infected files.

Alternatively, if you have a huge website, you can also consider WordPress security and maintenance services that will help you out with the entire monitoring and getting your hacked website back.

Final words

To conclude, this was all about how you can log in to admin after your WordPress is hacked. You can use any of the methods. Also, make sure you use a reliable security plugin that will monitor your website. Also, you haven’t yet set up the regularly scheduled backups, you should do it now. Regular backups will be much more helpful when something like this happens. So, make sure you have a security plugin and a backup plugin for your WordPress website.

How to Clean a Hacked WordPress Website using WPServices?

WPServices provides a risk-free WordPress malware removal service. 30 day money back guarantee, the most complete WordPress security plugin called iThemes Security Pro (worth $199 / year) + advanced security setup, and repeated hack protection for up to 1 year is included in the WordPress cleanup service. All of this has an industry best pricing – starting from / fixed website.

We value your time and thank you for reading our blog. So, we would like to show our appreciation by giving you an additional 10% discount on our malware removal service. Use coupon code WPAOSBLOG10 at the checkout.

Frequently asked questions

How can I prevent unauthorized access to my WordPress admin dashboard in the future?

To prevent unauthorized access to your WordPress admin dashboard in the future, you can take several security measures, such as using strong passwords, implementing two-factor authentication, regularly updating WordPress core, themes, and plugins, installing security plugins, limiting login attempts, and monitoring user activity logs. Additionally, consider using security best practices, such as disabling directory listing, protecting wp-config.php file, and restricting file permissions to enhance overall website security.

What should I do if I suspect that my WordPress website has been hacked?

If you suspect that your WordPress website has been hacked, take immediate action to secure your website and mitigate any potential damage. Change all passwords associated with your website, including WordPress admin, FTP, and hosting account passwords. Scan your website for malware using security plugins or online scanning tools and remove any malicious code or files detected. Restore backups of your website to a clean state if available and consider consulting security experts for further assistance and investigation.

How can I regain access to my WordPress admin dashboard if I’ve been locked out?

If you’ve been locked out of your WordPress admin dashboard due to a hack or other reasons, you can regain access by following several methods. First, try resetting your WordPress admin password using the “Lost your password?” link on the login page. If you still can’t access your dashboard, try accessing the wp-admin directory directly via FTP and temporarily renaming the plugins folder to deactivate all plugins, then log in to your dashboard and reactivate plugins one by one to identify the culprit causing the lockout. Alternatively, you can manually disable plugins by editing the wp-config.php file or using phpMyAdmin.

What should I do if I’m unable to regain access to my WordPress admin dashboard through conventional methods?

If you’re unable to regain access to your WordPress admin dashboard through conventional methods due to a hack or lockout, you may need to take more advanced troubleshooting steps. Consider contacting your web hosting provider for assistance, as they may be able to help you regain access or provide additional security measures. You can also seek help from WordPress support forums, security experts, or professional services specializing in website recovery and security.

How can I prevent future lockouts from my WordPress admin dashboard while troubleshooting login issues?

To prevent future lockouts from your WordPress admin dashboard while troubleshooting login issues, take precautions such as temporarily disabling security plugins or firewall rules that may be blocking your access, ensuring that your IP address is not blacklisted or blocked by security measures, and double-checking login credentials for accuracy. Additionally, communicate with your hosting provider or server administrator to ensure that server-level security measures are not causing login issues and seek their assistance in resolving any underlying issues.

Tailored WordPress Solutions

Elevate your online presence with our custom WordPress development services.

Our Blogs

How to get started?

Learn more

WordPress Hacked?

Get your WordPress website fixed today!

Get Started

WordPress Maintenance

Save 33% with our Annual pricing plan.

Get Started

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices