All is not lost when your WordPress website gets hacked, and you always have a backdoor database entry channel through which you can reach your site’s admin section, in a very convenient way.

You may lose access to your website’s admin section because of a number of reasons. The website may fail to establish a network connection, can have its memory limit exhausted and may suffer from PHP error as well. In these conditions, you would not be able to log into your admin account. You may also forget the password, and the main account’s admin email may no longer be valid because of some reason, which can be one other reason why you would fail to login into your account.

Another major reason when you would be not able to login to your website is when it gets hacked. You lose all your admin related privileges when your website gets hacked. Hackers gain entry to your website’s admin panel through a backdoor and then delete all your admin privileges, after infecting your website. You will find no themes and plugins on the website when it has been hacked, even when you can log-into a hacked website. Here at Templatetoaster WordPress website builder check out how to back your WordPress admin.

When all of your admin privileges and data has been deleted, then you can only login to your website through a new “admin user” id, that you can create by going into the PHP My Admin section.

Here is a step-by-step guide that will help you to create a new “admin user” within the WordPress website’s database, by using MySQL. It is always better to have a backup for all your website data before you undertake any kind of MySQL editing.

●Find your WordPress database after logging in PHP My Admin. You have to login into the “c panel” and then should follow the path

Databases > PHP My Admin.

Once you reach your database, you need to change two tables viz. wp_users and wp_usermeta.

●When you click on wp_users table, you will find the insert tab.


How to get back to your WordPress admin after being hacked

Figure 1


You will be required to add here:

  • An ID – You can pick any number
  • User password – Use any password and also select MD5 from the given function menu.
  • User login – Use any username that would provide you access to the dashboard of your WordPress website.
  • User nickname – Add a nickname or any other name
  • User email – Add a verified email id that you want to associate with this account.
  • User URL – This will be the URL of your website.
  • User registered- Select the time and date as to when the user has been registered on the website.
  • Display name- Add a display that can also be the same as your nice name.

Next click the “go” button.

After completing the WP_Users table, we need to fill in the WP_usermeta table. Click on wp_usermeta table and next click the “insert” tab. Now fill in the below-given information.

  • Meta_id- As it will be auto-generated and you should add no value here
  • User id- This would be the same user id that you had created in the first step.
  • Meta key- The wp_capabilities
  • Meta value- Insert the value a : 1:{ s : 13 : ”administrator” ; s : 1 : ”1”;}
  • You would also be required to add 1 more row of information
  • Unmeta id- Leave this value blank as it would be auto-generated
  • User id- This would be the same id that you created in the first step
  • Meta key- This would be wp_user_level
  • The meta value- 10

Now you can click on the “go” button as you have created a new id or username for yourself. You can use the new login credentials for logging into the wp_admin. You have to use the same username and the same password that you specified and used before. Once you get inside your website’s admin after logging in successfully, you can further edit the username that you have only created seconds before. Click on the website’s “Save” button so that the new username gets added to the database. WordPress will add more relevant information to this newly created account.

Reviewing And Recovering The Website

Now you can easily gain access to the backend section of your WordPress website. Go to your login page, click on the “lost your password link”, enter the new email id that you added to your account earlier and the click on the “get new password button.” You will get an e-mail that offers you a link for choosing any new password. Be careful and choose and use a secure password having a mix of characters, letters, and signs.

Once you login to your website, install the latest updates, so that the security loopholes can be prevented. Some solutions also help you to scan all your malicious codes and should be installed on the website for greater security. VaultPress and Defender are a few tools in this area that are quite efficient. You can also install a backup-restore solution.

“Sucuri” Security

Sucuri is one of the best website security provider company. The plug-in is free of cost. Run the scan so that the software can check the integrity of your files, malicious codes and do a security audit. The security plug-in will also recommend to you certain options that will help you to make your website’s security full proof.

Rare Cases

There would be rare cases when the hack would come back again and again. Sometimes you would not be able to locate the right malicious code. You should understand that hacks affect thousands of websites. The official WordPress online forums are one of the best places where you can get the best and most comprehensive support from experts and other users. Describe your problem in the widest possible detail to get the right recommendations.


The Web is always exposed to attacks made by hackers and bugs. You should always have the most recent updates duly installed on your website and use all security measures available to you, in order to remain safe.