Skip to content

Instantly share code, notes, and snippets.

@hermpheus
Created March 23, 2012 23:42
Show Gist options
  • Save hermpheus/2176425 to your computer and use it in GitHub Desktop.
Save hermpheus/2176425 to your computer and use it in GitHub Desktop.
WordPress: Create Admin Account via FTP
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');
@hermpheus
Copy link
Author

From George Stephanis (http://stephanis.info/index.php/archives/399-create-new-admin-account-in-wordpress-via-ftp). Very helpful, although I usually find myself in the opposite situation. Gotta find an FTP plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment