Pippin and Jean-Baptiste Jung have very good tutorials on how to programmatically create content when a new post is published using these four actions hooks...
- publish{post_type}
- add_action('new_to_publish_{post_type},
- add_action('draft_to_publish_{post_type},
- add_action('pending_to_publish_{post_type}
... to run this script...
global $user_ID;
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);
What hook should I be using to do this function only when a post is updated? Thank you!