自定义评论类型 wordpress [英] Custom comment type wordpress
本文介绍了自定义评论类型 wordpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我插入评论时,我使用以下代码
When i insert a comment i use the following code
$data = array(
'comment_post_ID' => $postid,
'comment_content' => 'User Review',
'comment_type' => 'review',
'user_id' => $userid,
'comment_date' => $time,
'comment_approved' => 1,
);
$commentid = wp_insert_comment($data);
如果我尝试根据comment_type"获取这些评论,则不会得到结果
If i try to get these comments based on "comment_type", I am not getting results
$args = array(
'user_id' => $userid,
'post_type' => 'review'
);
$comments = get_comments($args);
get_comments 不能用于获取特定类型的评论?
get_comments can't be used for getting comments of particular type?
如何获得type review的评论?
How to get comments of type review?
推荐答案
试试这个代码,我希望这会有所帮助.
Try this code, I hope this will help.
$args = array(
'user_id' => $userid,
'type' => 'review'
);
$comments = get_comments($args);
这篇关于自定义评论类型 wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文