Add a administor user to your WordPress Site via FTP/SFTP

Paste this snippet into their current theme’s functions.php file, or add it to a new file in their ~/wp-content/mu-plugins/ folder, and WordPress will automatically create an admin account for you to use!

Don’t forget to change the credentials that are included to your own. If there is already an account with the username or email address specified, it will fail.

function add_admin_acct(){
	$login = 'myacct1';
	$passw = 'mypass1';
	$email = '[email protected]';

	if ( !username_exists( $login )  && !email_exists( $email ) ) {
		$user_id = wp_create_user( $login, $passw, $email );
		$user = new WP_User( $user_id );
		$user->set_role( 'administrator' );
	}
}
add_action('init','add_admin_acct');