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
1352348133
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.