繁体   English   中英

通过批准过滤wordpress评论

[英]Filter wordpress comments by approved

我用它来为我的自定义主题获取wordpress评论:

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

除了不过滤等待审阅的注释之外,其他所有方法都起作用。 遵循编解码器: http : //codex.wordpress.org/Function_Reference/get_comment'status'= 'status' => 'approve'应该将其过滤掉,但这似乎没有发生。

我不是用正确的方法吗?

尝试approve两个P!

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

这是get_comments的文档页面 (您链接到单数形式的get_comment 。)

这个对我有用。 您可以使用以下代码在段落中显示批准的注释。

<?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; ?>

我已在以下网站中使用显示评论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