Title: wp_insert_user Not Working
Last modified: August 20, 2016

---

# wp_insert_user Not Working

 *  [gilbertoalbino](https://wordpress.org/support/users/gilbertoalbino/)
 * (@gilbertoalbino)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_user-not-working/)
 * Hi there guys, I’m trying to create a form is submited.
    The code I used to test
   is this:
 *     ```
       $userdata = array(
       	'user_login' => 'login',
       	'user_email' => 'user@email.com',
       	'user_pass' => wp_hash_password('123456'),
       	'user_url' => 'http://none.com',
       	'display_name' => 'John Doe',
       	'description' => '',
       	'role' => 'author'
       );
   
       $user_id = wp_insert_user( $userdata );
       ```
   
 * Nothing happened!
 * Tried with wp_create_user() and nothing happened too!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [gilbertoalbino](https://wordpress.org/support/users/gilbertoalbino/)
 * (@gilbertoalbino)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_user-not-working/#post-2475005)
 * Still can’t find a solution.
    I have tried a lot of things but nothing seems 
   to work!
 *  Thread Starter [gilbertoalbino](https://wordpress.org/support/users/gilbertoalbino/)
 * (@gilbertoalbino)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_user-not-working/#post-2475011)
 * P.S.: I want to create the user outside add_action.
 *  [ddjjmm](https://wordpress.org/support/users/ddjjmm/)
 * (@ddjjmm)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_user-not-working/#post-2475233)
 * $user = array(
    ‘user_login’ => $user_login, ‘user_pass’ => $user_pass, ‘first_name’
   => $first_name, ‘last_name’ => $last_name, ‘user_email’ => $user_email );
 *  $user_id = wp_insert_user($user);
 * works for me
 *  [ddjjmm](https://wordpress.org/support/users/ddjjmm/)
 * (@ddjjmm)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_user-not-working/#post-2475234)
 * All variables are Strings/no functions etc.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wp_insert_user Not Working’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [ddjjmm](https://wordpress.org/support/users/ddjjmm/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_user-not-working/#post-2475234)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
