0

I have a WordPress website with 111 users, I have to import +45000 users who had a predefined user_id starting from 31800001 to 32200905.

I know that I can import and set their user_id to their, already defined, id.

But I want that my next users keep this sequential ID, so the following user who register at my website after my import would need to have 32200906 has user_id.

When I try with a BETA the next user who registers has 112 as user_id.

So I am looking for a way to set a minimum for my following user_id. Any ideas ?

I think I could create 32200900 lines in my wp_usermeta + wp_users to fill the table with "fake accounts" in my database but, as you can imagine, I would prefer to avoid this ^^.

Thanks by advance ! Jonathan

4
  • Am I correct in assuming that the user IDs you want to preserve as also shown to the user and or site administrator for some other purpose, say for example, as a customer reference number where a user may quote their user ID or similar?
    – Adam
    Dec 16, 2022 at 17:51
  • 1
    Curious as to why you need to maintain these IDs. Are they from another WP installation?
    – vancoder
    Dec 16, 2022 at 18:21
  • you wouldn't need to do it in the user meta table to keep the IDs but you would in the users table. You shouldn't be importing using a method that requires IDs to be kept though. If these IDs are exposed to users and that's why you want to keep them then you can store them in user meta so that the actual user ID is irrelevant. Even if you manage to get them in and keep the sequential IDs, it's no guarantee that they will continue to be sequential, it's the database engine not WordPress that increments the row ID, and WP will still show those dummy rows and attempt to process them
    – Tom J Nowell
    Dec 16, 2022 at 19:00
  • It is needed because we switch from a "CRM-like" donation platform to a simple wordpress with a donation form. Our only prerequisites are to keep the IDs used previously because we send donor cards specifying this ID.
    – JARYOP
    Dec 19, 2022 at 9:33

1 Answer 1

0

You can access via phpMyAdmin and change the Auto Increment number to be your next user ID number.

Open phpMyAdmin Go to SQL tab at the top.

Enter the following:

ALTER TABLE 'wp_users' AUTO_INCREMENT=32200906;

Now create a new user and the ID should be 32200906

1
  • Thanks a lot, it seems to work great ! You save me a lot of time !
    – JARYOP
    Dec 19, 2022 at 9:31

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.