I would like to insert data into the wp_posts table with the inserted post_id in the 'guid' for a record that doesn't already exist. Below is the closest I've gotten but this doesn't work ($postarr['ID'] is equal to 0).
function filter_handler( $data , $postarr )
{
if($data['post_type']=='ai1ec_event'){
$my_post_id = $postarr['ID'];
$data['guid'] = get_option('siteurl') .'/?post_type=ai1ec_event&p='.$my_post_id.'&instance_id=';
}
return $data;
}
add_filter( 'wp_insert_post_data' , 'filter_handler' , '99', 2 );
$mypost = array(
'post_author' => 1,
'post_content' => 'Test',
'post_status' => 'publish',
'post_title' => $_GET['assignment_name'],
'post_type' => 'ai1ec_event',
'guid' => ''
);
$postid = wp_insert_post($mypost);