I'm creating a custom import script to migrate CSV data into wordpress. Each post has a series of attachments that must come with it.
Following chapter 14 (importing via a custom mysql script) in the book Wordpress Professional Development (1st edition), Everything is importing fine, except the book does not explain how to get attachments into posts.
I can see my custom posts in wp_posts, and I can see the attachment post_type. But I can't see how the two are related.
I'm assuming that I'm going to have to save the post first, get the id, and then use that somehow in a relationship with the attachment.
What would be the workflow here (if that's incorrect)? Can you provide an example insert statement(s) that demonstrate how to use sql to get a post into Wordpress?