It is very frustrating if you lose access to your site backend. If you forget your username or you are fixing hacked WordPress site and need to regain access to the WordPress backend. You can access the backend by resetting the password or by creating a new admin user in WordPress.

Adding admin users in WordPress is very easy if you have FTP access. First, you need to connect your site via FTP. You can access site files via CPanel file manager or FTP client such as FileZilla.

How to Add an Admin User in WordPress using FTP

After connected to site files, you need to locate the theme function file for adding the code. You can find the theme function file on the following path:
/wp-content/themes/your-current-theme/functions.php

Open the function.php file and add the following code:

function wpb_admin_account(){}
add_action('init','wpb_admin_account');
  • Replace ‘Username’ with new username
  • Replace ‘Password’ with desired password
  • ’email@domain.com’ with your new email

Save the file. After all the above steps, go to the WordPress login URL that is yoursite.com/wp-login.php .

Login with a new username and password. Once login successfully, don’t forget to delete the code from the function.php file.

 

 

Pin It on Pinterest

Shares
Share This