So, I'm trying to create a new user account with wp_insert_user based on credentials I receive from a Facebook user profile. I want the new user account ID to equal the Facebook account ID (ex: 1352348133).

If I set the ID parameter as per the Wordpress wp_insert_user reference page the user account is not created in wp_users as I would expect, however all the relevant meta data IS inserted in the wp_usermeta table. If I remove the ID parameter from the array I pass to wp_insert_user it creates the new record in wp_users as it would normally.

I was expecting to get a return error but it actually returns the newly created user ID on success. Here is an example of the code I'm passing:

$insert_user = wp_insert_user(array(
    'ID'              => 1352348133,
    'user_login'      => 'jdizzle',
    'user_nicename'   => 'jdizzle',
    'user_url'        => 'https://www.facebook.com/jdizzle',
    'first_name'      => 'Jared',
    'last_name'       => 'Eitnier',
    'display_name'    => 'Jared Eitnier',
    'nickname'        => 'jdizzle',
    'user_registered' => date('Y-m-d H:i:s'),
    'role'            => 'customer'

and the return value of


I thought maybe the auto_increment on the ID field in wp_users might affect something but disabling that had no effect. Typecasting as an int had no effect. Length of the int isn't an issue.

1 Answer 1


According with Wordpress documentation, if a user ID is pass to the wp_insert_user() function, it will try to modify the user with that ID if exists, but a new user won't be created. You sould store the facebook ID as user_meta.

  • Good call, I didn't piece the two together. I added the facebook ID as user_meta instead. Thanks! Sep 25, 2013 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.