I have a Wordpress site that is considerably popular. I am in the process of optimizing the site before adding other plugins such as the WPML plugin which I suspect will be using custom post types. The site already has other plugins which I don't suspect use the wp\_posts table for custom post types except for 1 or 2 just to create.

**Is it possible to rebuild/update/reorder the ID column in the wp\_posts table such that the post IDs start from 1 and increase without any gaps.**

The wp\_posts table contains 3,349 rows. The site contains around 412 posts (post type) in the wordpress wp\_posts table. The largest number in the ID column is 7060 (this is very large)and any new post I add will increase the number to 7061. The rest of the rows in the table are other post types such as attachments some of which were created by old plugins. There is 2,786 rows for the attachment post type which is a very large number considering I won't be using these attachments anymore. The 412 posts contain all the information needed for the site. I am converting the images to inline SVG and latex. Most of the images were numbers. So after all this I will probably have 412 rows in the wp\_posts table.

I know I could reset the AUTO\_INCREMENT back to 1 by using;
 ALTER TABLE tablename AUTO\_INCREMENT = value;  

But I am not sure how to reorder the post IDs. I want to see what precautions I should be aware of before attempting this. I think this is important to simplify the Post IDs because they're going to be used all over the Multi site. If there is a solution that could reorder and update the entire references to the posts across other tables that would be great!.

I am aware that this is a MySQL feature and I will have to work with AUTO\_INCREMENT.

I am aware that other post types such as attachments may contain a parent id linking to the original posts. I am not so worried about attachments because I want to get rid of the 2,786 attachments anyway.

I will probably loose the tags and categories but simplifying the post IDs is vital. I will be rebuilding the tags and categories anyway. Is there a neat way to keep these tacked.

Is there any other dangers I should worry about? Because lots of scripts/features are going to be built around the main site posts I want to make the post IDs as unique as possible at this point. Having a gap of 100s is not unique for me.

I hope someone has the perfect solution for this. Am I attempting a very dangerous idea?