I'm having an issue with using wp_insert_post. I'm adding the ability for a post of one type to create a post of another type with the first post as the post parent. I was testing out a few things using the save_posts filter. I created a function that simply creates a post and then hooked that function to the save_posts filter. The problem I'm having is that it is adding posts exponentially to my mySQL table. The longer I let it run before I put a freeze on the server, the more posts get added. Is there a better way of doing this?
Example code:
public function save() {
$my_child = array(
'post_title' => $this->_child_type,
'post_content' => "test content",
'post_status' => 'publish',
'post_type' => "video",
'post_parent'=> 55
);
$nindex = wp_insert_post($my_child);
}
add_action('save_post', array(&$this, 'save'));