The beauty of this technique is its simplicity. The wp_create_user() function accepts only three arguments — name, password, and email — so it’s quick and easy to implement just about anywhere. Upon completion, the function returns either the new user ID or an error. So you can check for successful user creation like so:

Create new user via wp_insert_user()

If the simplicity of wp_create_user() is not sufficient for your needs, check out the WordPress function, wp_insert_user(). With wp_insert_user(), you can customize more than just the name, email, and password — in fact, you can pass an entire array of parameters or even use the WP_User object. Here is an example showing how it used: