Post ids are incrementing by an unknown number?

Every revision or auto-draft that’s saved is added to the database and given its own auto-incremented ID. So in theory, you could turn off post revisions ( adding the line define('WP_POST_REVISIONS', false); to your wp-config.php), and be very careful to write your posts in exactly the order you want your IDs to follow, and you’d get sequentially ordered posts. (Maybe, that is – I’ve never tried, and I think there may still be an autodraft created on first visiting the post-new.php screen, so it could be that the best you can do is make sure your post IDs increment by twos.)

This seems like a sure recipe for obsessive-compulsive disorder, though. A post ID is just a database key, no more or less, and it shouldn’t have any special meaning to you.

If you need or want your posts to be represented by integers in some kind of logical descriptive order, there are other ways of doing that. Here’s an answer I gave to another similar question that demonstrates a way of using post meta to sequentially number posts: Display post number not post ID number

Leave a Comment