As Konstantin Kovshenin pointed out in this article, you can get the comments for a specific Category like that:
<?php
$show_comments = 10;
$i = 0;
$comments = get_comments("number=50&status=approve");
foreach ($comments as $comment)
{
$comm_post_id = $comment->comment_post_ID;
if (!has_term( 'XYZ', $comm_post_id );)
continue;
$i++;
// Output the comment, author and whatever you need
// I'll just output the comment excerpt to keep my code simple
?><li><?php comment_excerpt(); ?></li><?php
if ($i >= $real_comments) break;
}
?>
Related Posts:
- How to remove these comments and html tags from the content?
- How to Add text to the start of all comment?
- R: Comment out block of code
- How to rearrange fields in comment_form()
- Commenting in user profile page?
- How do I delete all comments from a specific old blog post?
- Removing the “Website” Field from Comments and Replies?
- How to load and show comments with AJAX instead of pagination?
- Comments not appearing at all
- Comment Count for each Comment Author
- get recent comments of a particular category
- Hook/Filter before and after comments
- Comment form validation
- Sticky Comments
- Comments number message in password protected post
- Disable Comments Feed
- Use rich text editor in comments?
- Can I seperate comments from post?
- I have tried using Plugins to remove 72K comments with no success
- Display commenter’s registration date on comments?
- show un-approved comments at wordpress front end
- How to add consent checkbox in comment section
- How to add pagination to comments?
- WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’
- How to get replies of a comment?
- Report spam button
- Recent comments from my blogs only
- Share comment to twitter after publishing [closed]
- changing comment-page-# to something like review-page-#
- show if comment is in moderation
- Disable or Enable Comments on Front end [closed]
- Deleting the attached “comment replies” when trashing a comment
- How can I get a list of comments by target
- Load comments.php template outside the post loop
- Auto-fill Custom comment fields
- Highlighting the current users comment
- How to make all the posts commentable by default? Imputs in Settings/Discussions are not saved
- How to auto empty comment trash after X days
- comments.php keep comment date/time but remove date/time’s #hyperlink
- Add filter to comments loop?
- Show comments to unregistered users
- Control panel loads slowly due to 2 slow queries on comment table
- Display complete comment section via post ID
- Comment Pagination Behavior wp_list_comments() – comment ordering and pagination
- Check if comment was successfully submited
- After Submitting Comment Form Shows an Empy Page in WordPress
- Unique User for all visitor, but possibility to comment with unique name
- comments_array filter doesn’t work in some themes
- Redirect when click on “response” in comment section
- Troubleshooting Emoji in Comments
- Link to a User’s Forum Profile From Their Comment
- if user role is then echo text
- strange behavior with comment position
- Safely editing core files
- Woocommerce comments subscription [closed]
- Way to count the number of people who have commented on a post?
- Batch approve comments
- Disable comments and pingbacks on old custom post types
- Add paragraph tags to comments
- How to tweak comment fields properly from functions.php
- How to allow duplicate comments?
- Advanced Custom Fields comments [closed]
- Are there some caveats for using guids for FB comments
- Two textareas showing up in comments.php
- WordPress comments – delimiter “/” not found
- Make email not required comments.php
- Give subscribers the option to post anonymously
- Thesis Theme Custom Loop
- Styling Admin comments in WP 3.1.3
- Displaying comment counts in WP Gallery thumbnail view
- Removing comment option
- pre_comment_content filter not working using IntenseDebate Enhanced moderation
- How t Remove Labels from comment Box
- How to remove a span class?
- Edit Comments Fields
- Random output of comments using a shortcode
- Allow comments only for custom post type
- Comment author profile image
- Comment Form Fields when user logged in
- wp_mail doesnt work inside transition_comment_status
- How add custom text under comment form
- Can’t hover on Submenu
- Can I allow registered users to comment without being logged in or having to be approved?
- Showing different images depending on user role
- Why the capability ‘activate_plugins’ is needed to allow a role to see all posts/pages/comments?
- How to require users not to be logged in for comments on single page only?
- How can I eliminate all comments going into moderation?
- WordPress shows admin’s avatar after editing a comment
- How to change comment-page-1#comment-25 to any string?
- change text written in english into hindi
- comment-reply.js always focuses on comment textarea
- I need to delete all posts from my homepage & create a static front page [closed]
- Is there a better way to check for a new comment?
- Add comment meta
- Comments from mobile apps & Disqus
- Commentform – Hightlight invalid fields instead of prompting towards error page
- How do I get the comments section to show up?
- How to remove or customize “Comment” in comments form?
- Getting thousands of spam comments
- check if a comment was made by a registered user