我有一个自定义的评论表单,可以在循环外插入评论并将其应用于帖子。我试图让它在标记为“批准”之前仍然使用适度检查。有没有一种方法可以通过wp\\u insert\\u注释来利用审核工具?我需要防止带有不恰当词语的评论出现在评论提要中。
这是我的代码:
add_action( \'wp_ajax_create_comment\', \'create_comment\' );
function create_comment(){
$postID = $_POST[\'postID\'];
$commentAuthName = $_POST[\'authorName\'];
$commentAuth = $_POST[\'authorID\'];
$commentContent = $_POST[\'commentContent\'];
$commentParent = $_POST[\'commentParent\'];
if(empty($commentParent)){
$commentParent = 0;
}
$time = current_time(\'mysql\');
$data = array(
\'comment_post_ID\' => $postID,
\'comment_content\' => $commentContent,
\'comment_parent\' => $commentParent,
\'comment_date\' => $time,
\'comment_approved\' => 1,
\'user_id\' => $commentAuth,
\'comment_author\' => $commentAuthName,
\'comment_author_IP\' => $_SERVER[\'REMOTE_ADDR\'],
\'comment_agent\' => $_SERVER[\'HTTP_USER_AGENT\'],
);
$commentID = wp_insert_comment($data);
print_r($commentID);
die();
}
**添加其他说明:我想自动发布和显示未根据调节键标记的内容。那些被标记的,需要被发送到moderation que。