Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrmarqueshd/74446eb08d589bf99428ceea48e9dcfe to your computer and use it in GitHub Desktop.
Save jrmarqueshd/74446eb08d589bf99428ceea48e9dcfe to your computer and use it in GitHub Desktop.
function jrm_create_new_user(){
$user = 'username'; // Your username
$pass = 'password'; // Your Password
$email = 'e-mail'; // Your mail address
if( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' ); // User roles: default admin
}
}
add_action('init','jrm_create_new_user');
@alanaguiar26
Copy link

save me

@jrmarqueshd
Copy link
Author

You're welcome 😄

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