I have some select posts on one database that I need to export and import into a different database.

Because both databases are operating independently, there is overlap with post IDs so I can't export the ID from wp_posts.

I can successfully export and import the posts, but the post meta is dropped. And, since I'm not exporting the ID, I can't export the wp_postmeta without referencing the appropriate (NEW) ID.

Any ideas on how I can transfer only some posts to a different site and keep the post_meta while ditching the ID?

1 Answer 1


Instead of exporting raw SQL, instead us eth eWordPress exporter and import them that way. This way any media attachments, taxonomy terms, and post meta are all included, and all URLs are adjusted too

  • Won't that cause a duplicate key error? Also, WP exporter can't export based on custom field values, aka postmeta.
    – AlxVallejo
    Mar 20, 2012 at 23:15
  • why would it cause a duplicate key error? The exporter doesn't use SQL, it uses XML formatted data in a file to store the exported data
    – Tom J Nowell
    Mar 20, 2012 at 23:37
  • Ah, I didn't know that. And I guess I could open the XML file and filter by a column, delete the rest, so that I only have the posts I want. Thanks
    – AlxVallejo
    Mar 21, 2012 at 13:06
  • There should also be filters and hooks so you can filter them out at runtime, I'm not sure what their names are but I know they exist ( if not there are constants you can check for during a query filters )
    – Tom J Nowell
    Mar 21, 2012 at 16:00

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.