Try This i think..
// Finally; Post Into The Database
function wp_ai_post($title, $content, $timestamp = null, $category = null, $status = 'draft', $authorid = null, $allowpings = true, $allowcomments = true )
{
global $wpdb;
$date = ($timestamp) ? gmdate('Y-m-d H:i:s', $timestamp) : null;
$postid = wp_insert_post(array(
'post_title' => $title,
'post_content' => $content,
'post_content_filtered' => $content,
'post_category' => $category,
'post_status' => $status,
'post_author' => $authorid,
'post_date' => $date,
'comment_status' => $allowcomments,
'ping_status' => $allowpings
));
do_action('publish_post', $postid);
return $postid;
}