Title: Error when adding new records to user database
Last modified: May 29, 2019

---

# Error when adding new records to user database

 *  Resolved [senseiussd](https://wordpress.org/support/users/senseiussd/)
 * (@senseiussd)
 * [7 years ago](https://wordpress.org/support/topic/error-when-adding-new-records-to-user-database/)
 * I get the following error when my code runs wp_insert_user(). It does create 
   a new user but fails to add some, but not all, of the meta data. I can activate
   and deactivate your plugin and the problem comes and goes with that.
 * Warning: Cannot modify header information – headers already sent by (output started
   at /home/ussdstud/public_html/dragontournaments/wp-includes/class.wp-styles.php:
   297) in /home/ussdstud/public_html/dragontournaments/wp-includes/pluggable.php
   on line 928
 * If you need to see this in action, let me know and I will put together a page
   to demo the problem. You will need login credentials.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-when-adding-new-records-to-user-database%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Jeff Sherk](https://wordpress.org/support/users/jsherk/)
 * (@jsherk)
 * [7 years ago](https://wordpress.org/support/topic/error-when-adding-new-records-to-user-database/#post-11582270)
 * If you disable all other plugins and leave mine active, does the issue go away?
 * Most likely this is being caused by a conflict with another plugin so we need
   to figure out which one.
 * Let me know if you can troubleshoot that or not.
 *  Thread Starter [senseiussd](https://wordpress.org/support/users/senseiussd/)
 * (@senseiussd)
 * [7 years ago](https://wordpress.org/support/topic/error-when-adding-new-records-to-user-database/#post-11584647)
 * I disabled all plugins except this one and the problem does not go away. This
   is the code I am using.
 * function create_competitor(){
    if (isset($_POST[‘ncheck’])){ $userdata = array(‘
   user_login’ => ‘bobbilly’, ‘user_url’ => ‘xxxxx’, ‘user_pass’ => NULL, ‘first_name’
   => ‘bob’, ‘last_name’ => ‘billy’, ); $user_id = wp_insert_user( $userdata ) ;}?
   > <form method=”post”> <input type=”hidden” name=”ncheck”> <input type=”submit”
   name=”submitnew” value=”Save This Student” id=”submitnew”/> </form> <? }
 *  Plugin Author [Jeff Sherk](https://wordpress.org/support/users/jsherk/)
 * (@jsherk)
 * [7 years ago](https://wordpress.org/support/topic/error-when-adding-new-records-to-user-database/#post-11585291)
 * If you remove this code, does my plugin function properly?
 * Also, can you clarify… Is this your own custom plugin you are using? Or is this
   a custom function you have added to functions.php? It’s unclear to me where/how
   you are using this code.
 *  Plugin Author [Jeff Sherk](https://wordpress.org/support/users/jsherk/)
 * (@jsherk)
 * [7 years ago](https://wordpress.org/support/topic/error-when-adding-new-records-to-user-database/#post-11627309)
 * No response from OP so marking as resolved.

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

The topic ‘Error when adding new records to user database’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/auto-login-new-user-after-registration_0a52c9.
   svg)
 * [Auto Login New User After Registration](https://wordpress.org/plugins/auto-login-new-user-after-registration/)
 * [Support Threads](https://wordpress.org/support/plugin/auto-login-new-user-after-registration/)
 * [Active Topics](https://wordpress.org/support/plugin/auto-login-new-user-after-registration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/auto-login-new-user-after-registration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/auto-login-new-user-after-registration/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Jeff Sherk](https://wordpress.org/support/users/jsherk/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/error-when-adding-new-records-to-user-database/#post-11627309)
 * Status: resolved