I am trying to determine a user's identity using the WordPress API from a mobile app. I'm storing the userId as a unique identifier for the user's account on WordPress.
Are the userId's of deleted accounts recycled? In other words, put back into the pool of potential userIds for new users.
CodePudding user response:
This is very unlikely (although not impossible) that WordPress generates ids on the application level - most probably this is something that database is responsible for (via auto incremented sequences).
So the question is which database (and version) is being used for the app. If this is a default for WP - MySQL - than there is an additional question what storage engine is being used.
In older versions of MySQL powered by InnoDB the removed ids could be reused in some edge cases. This was considered a bug and fixed started from MySQL 8.0.0.
So, if your DB is MySQL >8.0.0 than it is safe to assume that ids are never reused regardless of the storage engine. If the database is older and powered by InnoDB - ids might be reused in certain cases.
If your WP setup is "non-default" and uses a different database it is better to refer to that DB documentation (but most modern databases don't reuse ids because this could cause huge problems with the data integrity)