wp_create_user( 'johndoe', 'passwordgoeshere', 'john.doe@example.com' );
$user_data = array(
'ID' ( null | integer ),
'user_pass' ( null | string ),
'user_login' ( null | string ),
'user_nicename' ( null | string ),
'user_url' ( null | string ),
'user_email' ( null | string ),
'display_name'( null | string ),
'nickname' ( null | string ),
'first_name' ( null | string ),
'last_name' ( null | string ),
'description' ( null | string ),
'user_registered' ( null | string ),
'role' ( null | string ),
'jabber' ( null | string ),
'aim' ( null | string ),
'yim' ( null | string ),
'locale' ( null | string ) ,
);
wp_insert_user( $user_data );
function new_user_with_metadata( $username, $password, $email = "", $meta = array() ) {
$meta = array(
'job_title' => 'developer',
'country' => 'United States',
'viaphp' => true
);
$user = wp_create_user( $username, $password, $email );
if ( ! is_wp_error( $user ) ) {
foreach( $meta as $key => $val ) {
update_user_meta( $user, $key, $val );
}
}
return $user;
}