I use the ID in my URL, so it’s important to me that the IDs be at least somewhat sequential. When moving from Blogger to WordPress, I imported about 50 posts and the ID for the last one was in the 50’s. However, since doing that a couple of months ago, I’ve only made maybe four more posts, yet my IDs have shot up to around 115.
I did some research and it appears that every revision creates a new entry in the database. I disabled revisions in WordPress based on a post I found, so this should stop happening from this point forward, but I would now like to go into the database and 1) delete all of the revisions, and 2) resequence the IDs so that my post numbers are in the 60’s rather than in the 110’s. Essentially I want to fill in all of the gaps.
Is there a SQL script I can use to accomplish this quickly?
I don’t have anyone else linking to specific posts right now since my WordPress site is brand new, so I am not concerned about the permalink URLs changing. I just want to make sure to get this done ASAP because it will be much harder to change a few months from now. I also want to make sure this won’t break anything that’s already there. (I have no comments yet on the WordPress posts, and I don’t use metadata, so wp_comments and wp_meta aren’t of much concern to me – I will only be correcting the IDs of posts made on WordPress, not the ones imported from Blogger.)
- The topic ‘Re-sequencing IDs in the database’ is closed to new replies.