How to Add an Admin User in WordPress using FTP599

Author: InfoBeep - November 27, 2017 | subject to copyright

Why you may need to add an admin user in WordPress using FTP?

Sometime your site may get hacked and your admin account may be deleted. In this case, adding an admin user in WordPress using FTP can quickly restore you access to the WordPress admin panel.

Adding an admin user in WordPress using FTP

In order to add an admin user in WordPress using FTP, the first thing you need is FTP client. Now that you have got it, you may follow the steps below:

  • Locate your functions.php file in your WordPress. Your functions.php file should be located like this:
  • Right click on the functions.php file and click on download
  • Once downloaded, open your file using Notepad or any other plain text editor.
  • Read the code at the bottom of the file and replace the username, password and email with your own. Demo code is shown below:
function wpb_admin_account(){

$user = 'Username';

$pass = 'Password';

$email = '';

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' );

} }

  • Save the file and upload it back to your website using FTP client.
  • Now you can login to your WordPress admin panel. After logged in delete the code you added and we recommend you add another admin.