I am looking after a old site from a client and a lot of users dont have username.

I had setup in woocommerce "When creating an account, automatically generate a username from the customer's email address", but for some reason it is not creating username for the new user, so I unticked that and left the field mandatory.

Now, If an user with blank username request a new password, wordpress doesnt send an email. Only if I go manually to the phpmyadmin and included it. However there are more than 500 users without username. Is there a way to automatically get the user email for example and include in the username field?

Or make wordpress send email even with no username?

Thank you,


1 Answer 1


WordPress functions doesn't allow to modify user login then you need to change directly the database.

make a backup of you database and try this to fill login with something like user4589

UPDATE `wp_users` SET `user_login` = CONCAT("user", ID) WHERE `user_login` = ""
  • Thank you for replaying, I am not good using phpmyadmin, I went to the wp_users table, click on SQL tab and paste the code you informed. But I got this error: SQL query: UPDATE wp_users SET user_login = CONCAT("user", ID), WHERE user_login = "" MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE user_login = ""' at line 1 Commented Aug 8, 2018 at 16:15
  • I had to remove the comma before WHERE and it works. Thank you Commented Aug 9, 2018 at 9:43

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.