I'm puzzled with the following. Say, post_ID of my last post is 100. Now I remove all posts from my WordPress blog and even clear all revisions and so on from database if any, so now I have nothing in my wp_posts and wp_term_relationship. I expect to get post_ID = 1 for a new post. But I get post_ID = 101. Looks like WordPress stores ID for next post somewhere, but I've already spent half a day trying to figure out: where?

有帮助吗?

解决方案

It's just an auto incrementing column in the MySQL database. MySQL is using an internal counter, it's nothing to do with WordPress.

http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

Update

To reset your post ids, run the following (substituting in your tablename):

ALTER TABLE tablename AUTO_INCREMENT = 1
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top