1function wp_create_user( $username, $password, $email = '' ) {
2 $user_login = wp_slash( $username );
3 $user_email = wp_slash( $email );
4 $user_pass = $password;
5
6 $userdata = compact( 'user_login', 'user_email', 'user_pass' );
7 return wp_insert_user( $userdata );
8}