How To Reset All Post Ids In Wordpress

How to reset all post IDs in WordPress

If you’re like me then occasionally you might come across an instance where you are doing a lot of post imports in WordPress while doing some testing.

When this happens each imported post increases the post ID increment. After you get all the issues resolved you may wish to reset the post ID counts back to zero for a final fresh import of the data.

This can be accomplished relatively easily with the following steps and SQL query.

Wordpress Reset All Post Ids Sql Query

First, you would go into either phpMyAdmin or using your SQL software (I tend to prefer HeidiSQL.

Second, make a backup.

Finally, run the following SQL query:

DELETE FROM wp_posts;
DELETE FROM wp_post_meta;

TRUNCATE TABLE wp_posts;
TRUNCATE TABLE wp_post_meta;

After that your post IDs should be reset!

Leave a Reply

avatar
  Subscribe  
Notify of