【发布时间】:2015-05-15 06:48:01
【问题描述】:
我想创建系统以将 wordpress 帖子从前端插入到登录用户。但是我已经检查过不同用户多次添加的相同标题帖子。
如果帖子标题已经存在,我如何添加error message
这是我的代码
$u_id = get_current_user_id();
$my_post = array(
'post_title' => 'title',
'post_content' => 'this is post content',
'post_status' => 'publish',
'post_author' => $u_id,
'post_type' => 'customer_post',
);
$post_ID = wp_insert_post( $my_post );
【问题讨论】: