Title: Create user automatically
Last modified: January 7, 2018

---

# Create user automatically

 *  [jkepler](https://wordpress.org/support/users/jkepler/)
 * (@jkepler)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/create-user-automatically/)
 * Hi,
 * Is there a script (in php for instance) which might allow me to add an user with
   a passord to the database of my multisite WordPress? A script outside WP, not
   a plugin.
 * I ask this because I have a system for registration of users outside the WP frame.
   In that general space, when the user registers, I would like to give him an automatic
   WP blog/page.
 * Is this possible?
 * Kind regards
 * JKepler

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

 *  [Keith](https://wordpress.org/support/users/keithdriscoll/)
 * (@keithdriscoll)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/create-user-automatically/#post-9840777)
 * You should be looking at using the [REST API](https://developer.wordpress.org/rest-api/).
   This requires knowledge of coding but is how you would have other software communicate
   with WordPress.
 * REST API explained in plain english:
    [https://www.godaddy.com/garage/the-wordpress-rest-api-what-it-is-and-why-you-should-care/](https://www.godaddy.com/garage/the-wordpress-rest-api-what-it-is-and-why-you-should-care/)
 *  Thread Starter [jkepler](https://wordpress.org/support/users/jkepler/)
 * (@jkepler)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/create-user-automatically/#post-9840819)
 * Hi
 * Yes, it is the best way. So I’ll create an end point with my own credentials.
   Just a question if I may: inside that endpoint, is it enougn then to place
 *     ```
       $user_id = wp_create_user( $username, $password, $email_address );
         wp_update_user(
           array(
             'ID'          =>    $user_id,
             'nickname'    =>    $username
           )
         );
       ```
   
 * Must the user have and ID and both a username and nickname defined in wp_update_user?
   And I assume that the endpoint recognizes all these commands…
 * Sorry for the trouble.
 * Kind regards
 * JKepler
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/create-user-automatically/#post-9841908)
 * No trouble at all. All PHP and WP functions are available in endpoint processing
   code. You don’t _have_ to set a nickname, the create user function sets it to
   the login name by default. The create user parameters are all that is really 
   required. Your update user code is redundant since the create user function already
   set the nickname to the login name. The only reason to reset it would be if you
   want the nickname to be different than the login name.

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

The topic ‘Create user automatically’ is closed to new replies.

## Tags

 * [multisite](https://wordpress.org/support/topic-tag/multisite/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [script](https://wordpress.org/support/topic-tag/script/)
 * [user](https://wordpress.org/support/topic-tag/user/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/create-user-automatically/#post-9841908)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
