It smelss like a bug but adding the post_modified in wp_insert_post isn't working:
$wp_test = array(
'post_title' => 'test',
'post_content' => 'test',
'post_status' => 'publish',
'post_type' => 'test',
'post_author' => 1,
'post_date' => '2015-01-22 22:00:12',
'post_date_gmt' => '2015-01-22 22:00:12',
'post_modified' => '2016-04-18 12:12:12',
'post_modified_gmt' => '2016-04-18 12:12:12',
'comment_status' => 'closed'
);
$wp_id = wp_insert_post( $wp_test );
The post_modified date isnt working and gets the same value as post_date, not the wished '2016-04-18 12:12:12'. Is this a bug? i'm using wp 4.5 (twentysixteen theme). I fixed it by using the following code, but i think it could be more practical...
$wp_test = array(
'post_title' => 'test',
'post_content' => 'test',
'post_status' => 'publish',
'post_type' => 'test',
'post_author' => 1,
'post_date' => '2015-01-22 22:00:12',
'post_date_gmt' => '2015-01-22 22:00:12',
'comment_status' => 'closed'
);
$wp_id = wp_insert_post( $wp_test );
// ugly fix
$wpdb->query( "UPDATE $wpdb->posts SET post_modified = '2016-04-18 12:12:12',post_modified_gmt = '2016-04-18 12:12:12' WHERE ID = $wp_id");