Skip to content

Instantly share code, notes, and snippets.

@yoanmarchal
Created November 9, 2015 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoanmarchal/85c0511f9be3f0577777 to your computer and use it in GitHub Desktop.
Save yoanmarchal/85c0511f9be3f0577777 to your computer and use it in GitHub Desktop.
generate admin wordpress from FTP
function add_admin_acct(){
$login = 'yourlogin';
$passw = 'yourpassword';
$email = 'email@gmail.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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment