How To Create A New Admin Account Via FTP In WordPress

How To Create A New Admin Account Via FTP In Wordpress

Have you face a problem while accessing wp-admin login? Your client only gives you FTP account access? So don’t worry here is the solution to access wp-admin. Follow these steps to unlock the admin account.

  • Just copy and paste given code in theme function.php file
  • If you unable to find out the function.php file then go to ~/wp-content/plugins/folder and create new file with name function.php

WordPress automatically create an admin account that you can use!

function add_admin_account(){
	$login_name = 'myname';
	$password = 'mypass';
	$admin_email = 'myacct@mydomain.com';

	if ( !username_exists( $login_name )  && !email_exists( $admin_email ) ) {
		$user_id = wp_create_user( $login_name, $password, $admin_email);
		$user = new WP_User( $user_id );
		$user->set_role( 'administrator' );
	}
}
add_action('init','add_admin_account');

Note:  Oh — also keep in mind to change the credentials that are included to your own. When you are performed above steps, just save your file and refresh your website for once a new admin account has been created. Now you can easily login with given credentials. Go back to pasted code and remove it.

Login with these credentials if you are not changed any line of code.

Username : myname

Password: mypass


Alpha Web Developer offers superior, reliable and affordable Digital Marketing, Web Development and Mobile App Development Services to individuals and small businesses.

Recent Posts

Comments

  1. Muhammad Hassan Ali : July 19, 2016 at 11:02 am

    really very helpful ..good information .thanks “Alpha Web Developer”.

Leave a Reply

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