function cgp_create_post($title, $name){
$new_post = array(
'post_title' => $title,
'post_type' => 'custom-post-type',
'post_status' => 'publish'
);
$mypost_id = post_exists( $title );
if (!$mypost_id) {
$mypost_id = wp_insert_post( $new_post, true );
}
echo $mypost_id; //this was never echoed and the script abruptly stops here
update_post_meta( $mypost_id, 'times', '1' );
}
Above snippets of my code, result is the custom post is created but the line when i test value of $mypost_id by echoing it, it never echoed anything, the script also abruptly stop at that line.