How WP guesses which ID to use for new post?
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?
Solutions
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
Similar questions
How to tell which database tables belongs to which multisite site
I have a local multisite installation I use for development with a relatively large number of sites set up. Every site has its own numbered database tables (i.e. wp_n_links, wp_n_options, wp_n_postmeta etc.) Every time I need to look at a database table in phpMyAdmin I have to look through all the wp_n_options tables to find the tables for the site...
Which url points to which file
Actually i have deployed a wordpress running website on my local environment. I want to have some general instruction that how can i know which file points to which url. Like if i entered the url mysite.com/household-insrtuments. it opens a page in the backend i searched from the text through the project i found that this opens the file name 'housi...
WordPress: different WP_Query usage: Which is correct, in which context?
I have been creating custom WordPress loops with two different approaches, both which involve creating a new instance of the WP_Query object. I typically have multiple loops on a single page. I do not understand how these two approaches differ, and which is the correct context to use each. Approach 1: http://codex.wordpress.org/Class_Reference/WP_Q...
Also ask