dashed-slug.net › Forums › General discussion › Giving coins to users programmatically › Reply To: Giving coins to users programmatically
March 7, 2022 at 8:24 am
#11568
Keymaster
Hello,
Glad you figured the issue out.
The admin’s user_id is not 0
, it should be 1
by default.
I think WordPress starts counting from 1 because in MySQL, the primary keys for users, posts, etc are defined as AUTO_INCREMENT
columns, and AUTO_INCREMENT
columns start from 1
.
In fact, if you are certain that the user_id of the admin is 0, you may be facing bigger problems, caused by improperly exporting and reimporting a database via phpMyAdmin. I have blogged about it here. Are you able to create new posts? If not, you may be ecountering this issue.
Hope this helps.