All comments displaying on instead of just ones belonging to post
-
I’m using this loop that I got directly from the code reference on this site. The loop is in category.php and that template is being pulled into single.php. I just want the comments made on that post to display, but instead all comments are displaying.
<?php $args = array( 'status' => 'approve' ); // The Query $comments_query = new WP_Comment_Query( $args ); $comments = $comments_query->comments; // Comment Loop if ( $comments ) { foreach ( $comments as $comment ) { echo $comment->comment_content; } } else { echo 'No comments found.'; } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘All comments displaying on instead of just ones belonging to post’ is closed to new replies.