This is my loop:
<?php $ comments = get_comments(array( 'status' => 'approve', 'type' => 'comment', 'number' => 10, 'post_status' => 'public' )); ?> <ul class="sidebar-comments"> <?php foreach ($ comments as $ comment) { ?> <li> <div><?php echo get_avatar($ comment, $ size = '35'); ?></div> <em style="font-size:12px"><?php echo strip_tags($ comment->comment_author); ?></em> (<a href="<?php echo get_option('home'); ?>/?p=<?php echo ($ comment->comment_post_ID); ?>/#comment-<?php echo ($ comment->comment_ID); ?>">link</a>)<br> <?php echo wp_html_excerpt($ comment->comment_content, 35); ?>... </li> <?php } ?> </ul>
This always gives an empty result (no errors). If I remove 'post_status' => 'public'
from the get_comments arguments, the function works, comments load but also comments from private posts (which I don’t want).
Any ideas on why 'post_status' => 'public'
is not working?