Title: Creating child posts programatically
Last modified: August 20, 2016

---

# Creating child posts programatically

 *  Resolved [rsandilands](https://wordpress.org/support/users/rsandilands/)
 * (@rsandilands)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/creating-child-posts-programatically/)
 * Hi there
 * I have 2 custom post types, “Actor” and “Showreel”
 * An actor can have multiple child showreels. I can make this all work fine in 
   WordPress and display an actor with their child showreels fine.
 * However I’m wanting to parse an xml file that has actor information and all showreels
   for an actor.
 * So entering actors into the wordpress database is done by parsing the xml file
   and using wp_insert_post
 * However I’m wondering when I come to the child elements that list the associated
   showreels, how best to deal with them. Ideally I’d create them as child posts
   of the actor programmatically using posts 2 posts api but not sure if this is
   possible.
 * Any clues appreciated.
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/creating-child-posts-programatically/#post-3172216)
 * [https://github.com/scribu/wp-posts-to-posts/wiki/Creating-connections-programmatically](https://github.com/scribu/wp-posts-to-posts/wiki/Creating-connections-programmatically)

Viewing 1 replies (of 1 total)

The topic ‘Creating child posts programatically’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [scribu](https://wordpress.org/support/users/scribu/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/creating-child-posts-programatically/#post-3172216)
 * Status: resolved