I am wondering when I am importing posts from my old site into my new website, which has already some posts in it. Do the imported posts get a new ID or do they overrule the existing posts ID's?

2 Answers 2


I can confirm that the imported post will get a new unique ID if (and only if) there already is an existing/conflicting ID in the target database.

Given a post to be imported with an ID of 7579 (represented in the WXR export file as <wp:post_id>7579</wp:post_id>) and an existing post with that exact same ID already in the target database, the generated ID for the imported post was 7583.

(As far why 7583? I would have thought auto increment but 7579 was an existing post, 7580 a revision of that post and 7581 a draft of some sort. So not exactly sure why 7582 was skipped.)

  • Does it handles posts IDs in wp_term_relationships table?. We may lose that relationship between posts and terms. Mar 14, 2018 at 14:32
  • From my experience posts are OK with relationships. But attachments collide. Jun 10, 2020 at 23:51

The imported posts will get a new ID.

  • Please add an explanation to your answer. How do you know that?
    – fuxia
    Aug 19, 2014 at 15:41
  • I exported my database to give it a try and in the generated .sql file I have INSERT INTO wp_posts VALUES (1900,2,'2014-08-18 17:10:21' etc. where 1900 is the ID of the post. So I'm not entirely sure that a new ID is assigned if you import back when post or page with ID 1900 is still in the database. I would do it with codex.wordpress.org/Function_Reference/wp_insert_post if the database already has data.
    – WPRookie82
    Aug 19, 2014 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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