Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
    
Won't that cause a duplicate key error? Also, WP exporter can't export based on custom field values, aka postmeta. –  AlxVallejo Mar 20 '12 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 '12 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 '12 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 '12 at 16:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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