I'd like to update my users list with some user from a csv file generated by another database (witch i can access too) i'd like to create dynamically a user (with username, password and so on) and other custom fields (such as language, status, and other personal variables).

I've fetched my csv (that works), but when i try to create user with wp_insert_user, nothing happens :/

here's the code:

function clients_csv($file){

$csv = array_map('str_getcsv', file($file));

if(!email_exists($csv[7]) ){
print "CREATE USER";
'user_login' => $csv[4],
'user_pass' => wp_generate_password(12,false),
'first_name' => $csv[4],
'user_email' => $csv[7],
'role' => 'sbscrbr_subscriber'
update_user_meta( $user_id, 'lingua', $csv[1] );
print $csv[$i][$j];
print "

just for trial purpose, i call the function in the index file.

Thanks in advance

  • What debugging have you tried so far? What's the return value of wp_insert_user? – Andy Macaulay-Brook Jun 30 '16 at 7:30
  • it is very unlikely that "nothing happens" please edit your question and include what does happen and what debuging steps have you tried – Mark Kaplun Jun 30 '16 at 7:30

I found out the problem. i used wp_update_user to create the user, instead of wp_create_user.

my bad :/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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