Manjeet kashyap blog
$user_id = wp_insert_user( array(
'user_login' => 'janedoe',
'user_pass' => 'passwordgoeshere',
'user_email' => 'jane.doe@example.com',
'first_name' => 'Jane',
'last_name' => 'Doe',
'display_name' => 'Jane Doe',
'role' => 'editor'
));
if ( is_wp_error( $user_id ) ) {
$error_string = $user_id->get_error_message();
echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
}