Will post id change when migrating to new site?

I’m creating a rather complex plugin that synchronizes posts from your server with a thirdparty server. I need to know, if you migrate your wordpress server to a new site, “can” the post ids change? If so is there another unique id?

Also, is there any other instance where a post id could change?

If the id does change and there is no other unique id then chances are I’ll just do some complex md5 signature checking and string comparison if need be.

2 Answers
2

The wp_posts table has a guid field, which should be globally unique, and survive migrations. It is formed by taking the initial post URL, and never changed after that (when you change the title, change the website address, or migrate the posts). This should be pretty safe to base your synchronisation code on.

Leave a Comment