if I run the following code it returns me an int(0). Wordpress creates the Post but with an empty post_title although the $name variable is filled.
$postID = wp_insert_post(array(
"post_title" => $name,
"post_status" => "publish",
"post_type" => "mycustomposttype",
), true);
var_dump($postID);