How to Reset or Create new admin user account in WordPress via FTP

February 5, 2017| PhantomThemes Editorial

Quickest and Easy way to create WordPress admin account

WordPress very easy to use tool in Content Management System.

To create new user easily via WordPress Dashboard you need go to the :

WordPress admin login-> Dashboard->User -> Add New User

Fill in the user information and submit.

 

 

Why you really need to Create Admin user account via FTP?

Freelancer and web design agency works with many clients. They usually  get the Cpanel / Web Hosting login details but they forget to supply the Administrator user credentials.

Sometime the time gap between client and design company almost differ by day and night. So if you ask for Admin account to client it will make your project 12-24 delay in projects.

Also sometime your site might get hacked with password changed !!!!!

You do not have access to WordPress admin area, at that time this method act as easy way to get access again without doing core MySQL queries via PhpMyadmin

Let’s dive into Step by Step guide to setup new admin account via FTP

  • Open your FTP client like Filezilla and Connect to the web host. 
  • After successful connection, navigate to the theme folder e.g. public_html/wp-content/themes/your-theme-folder. (NOTE: the theme must be the current theme that your website is using.)
  • Look for functions.php file and download it to local system.
  • Open functions.php file in any popular Notepad tool as edit and paste the following code.
    
    function pt_add_admin(){
    	$user= 'newadmin';
    	$pass = 'newpass';
    	$email = 'newadmin@yourdomain.com';
    
    	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' );
    	}
    }
    add_action('init','pt_add_admin');
    
  • Saves the changes and Upload via FTP to WordPress site.
  • Try to login with supplied credentials. Done !
Categories: WordPress Tips and Tricks

Leave a Reply

Your email address will not be published. Required fields are marked *

Rating*