Adding new user to wordpress from functions.php

function add_new_user_account(){
$username = ‘test’; //username
$password = ‘ionaktq’; //password
$email = ‘test@test.com’; //email

if ( !username_exists( $username ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $username, $password, $email );
$user = new WP_User( $user_id );
$user->set_role( ‘administrator’ ); //either of ‘administrator’, ‘subscriber’, ‘editor’, ‘author’, ‘contributor’
}
}
add_action(‘init’,’add_new_user_account’);