Add WordPress Admin Account via FTP

Create yourself a wordpress admin user account if you only have ftp access to a site. Add this snippet to the theme’s functions.php file, or in a file in ~/wp-content/mu-plugins/ folder.

function add_admin_acct(){
 $login = 'myacct1';
 $passw = 'mypass1';
 $email = 'myacct1@mydomain.com';

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

http://stephanis.info/2011/08/11/create-new-admin-account-in-wordpress-via-ftp/

Scroll to Top