简体   繁体   English

通过批准过滤wordpress评论

[英]Filter wordpress comments by approved

I use this to get wordpress comments for my custom themes: 我用它来为我的自定义主题获取wordpress评论:

get_comments( array('status' => 'aprove','order' => 'ASC', 'post_id' => $newpost->ID) );

Everything works besides the fact that comments that are awaiting moderation are not filtered. 除了不过滤等待审阅的注释之外,其他所有方法都起作用。 Following the codex: http://codex.wordpress.org/Function_Reference/get_comment 'status' => 'approve' should filter those out but that doesn't seem to happen. 遵循编解码器: http : //codex.wordpress.org/Function_Reference/get_comment'status'= 'status' => 'approve'应该将其过滤掉,但这似乎没有发生。

Didn't I use it the right way? 我不是用正确的方法吗?

Try approve with two Ps! 尝试approve两个P!

get_comments( array('status' => 'approve','order' => 'ASC', 'post_id' => $newpost->ID) );

Here's the docs page for get_comments (you linked to get_comment singular.) 这是get_comments的文档页面 (您链接到单数形式的get_comment 。)

It works for me. 这个对我有用。 You can use the following code to show your approved comments in paragraph. 您可以使用以下代码在段落中显示批准的注释。

<?php foreach (get_comments(array('status' => 'approve','order' => 'ASC', 'post_id' => $newpost->ID)) as $comment): ?>
<div class="comment-show"><h4><?php echo $comment->comment_author; ?> said: </h4> <p>"<?php echo $comment->comment_content; ?>"</p></div>
<?php endforeach; ?>

i have used in following site to show comments http://rumpa07cse.com/how-to-index-your-website-and-blog-very-quick/ 我已在以下网站中使用显示评论http://rumpa07cse.com/how-to-index-your-website-and-blog-very-quick/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM