Skip to content

Instantly share code, notes, and snippets.

@malachi358
Created July 17, 2014 21:09
Show Gist options
  • Save malachi358/7c38423c563d844491ff to your computer and use it in GitHub Desktop.
Save malachi358/7c38423c563d844491ff to your computer and use it in GitHub Desktop.
Use FTP to Create New Admin User in WordPress
//Code retrieved at brianjohnsondesign.com
//http://blog.brianjohnsondesign.com/use-ftp-to-create-new-admin-user-in-wordpress/
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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment