Title: Adding Users within a Loop
Last modified: August 19, 2016

---

# Adding Users within a Loop

 *  [Chris Sanders](https://wordpress.org/support/users/csand10045/)
 * (@csand10045)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/adding-users-within-a-loop/)
 * I’m trying to add users from an array and the add_new_user function within the
   loop doesn’t seem to be working.
 * When I run it the first time, the first user is created (I see both dialog boxes),
   but the second user displays the first dialog box (before the create user)- but
   doesn’t display the second dialog box.
 * If I run it a second time, the first user displays the username exist dialog 
   box, it then iterates and displays the first dialog box (before create user),
   but again- doesn’t display the second dialog box so it has to be an issue with
   wp_create_user. The variables have been checked and should be okay. I’d appreciate
   any suggestions.
 * Code is in the pastebin:
 * [http://wordpress.pastebin.ca/2051226](http://wordpress.pastebin.ca/2051226)

The topic ‘Adding Users within a Loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [new-user](https://wordpress.org/support/topic-tag/new-user/)
 * [wp_create_user](https://wordpress.org/support/topic-tag/wp_create_user/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Chris Sanders](https://wordpress.org/support/users/csand10045/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/adding-users-within-a-loop/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
