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\' );
}
在我的代码片段上方,结果是创建了自定义帖子,但当我通过回显来测试$mypost\\u id的值时,它从未回显任何内容,脚本也突然停在了这一行。