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.

  • Thank you very much both of you. I had my suspicions about what Thomas was talking about. I'd vote both answers up but I lack the reputation : /
    – Thirlan
    Commented Mar 23, 2011 at 21:24
  • Also see here - my answer mostly referred to whether the post_id field is never changed, as I thought the GUID might change, but I was wrong (in the WP codebase, anyway). :))
    – nobody
    Commented Mar 23, 2011 at 21:34

It depends upon how the database is getting from one place to another.

If it's a straight copy of the database (obviously with edits for new site url): no.

Exporting the MySQL tables and importing them back in will create a carbon copy of the database - everything will be the same.

If you are importing (through the WP admin panel): yes.

Import allows for posts to be added to an existing blog and so the IDs cannot remain the same - the post_id must be unique across the post table, otherwise it is useless - so if a blog already has some content with the post ids [1..120] the imported content would take the IDs of [121...n+120]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.