If the comment rating is stored in the comment meta, then you can use:
$rating = get_comment_meta( get_comment_ID(), 'some-meta-key', true );
where you need to adjust the some-meta-key
accordingly.
If the comment rating is automatically injected into the comment’s text via the comment_text
filter, then you need to use the comment_text()
function to display it.
Here’s an example:
if ( $comments ) {
foreach( $comments as $comment ) {
// ...
comment_text( $comment );
}
}
Note that here you don’t need to run WP_Comment_Query
twice, as you do in your snippet, just to get the number of comments.
There’s also a core function for displaying star ratings: wp_star_rating()
Related Posts:
- Add option to disable comments on a per posts basis?
- Paginate result set from $wpdb->get_results()
- Change Comment Author Display Name
- How to allow the reply link to remain on the comment form after I have reached my 10 nested comment limit?
- Threaded comments – deleting parent comment leads to orphan comments
- How to remove commenters ability to add hyperlinks to comments?
- Is there a hook for comment author link?
- How can I edit the email sent when a new comment is received?
- How to remove or replace the log-in link for comment replies?
- How to Block Access to Standard Login Flow and Comment Flow
- Add Comment Custom Field
- Remove link preview in discussion dashboard
- Can’t add default comments to custom post type
- Prevent Contributor to show comment list
- where to modify get_comment_author_link()?
- Does Akismet plugin expose any hooks, functions, class that can work with custom code?
- Comments Feed & Custom Post Statuses
- Multiple Comment Forms in a single page [closed]
- Displaying comments with a walker: how to distinguish between parent and child comments
- Count parent comments & replies separately?
- How to modify comments form using comment_form()?
- Capability for allowing user to post own comments without moderation
- Comment form problem with comment_author_url and HTML5 input placeholders
- How would I count the number of times a comment meta field’s value is in a post’s entire comments?
- Get comment content by comment ID
- stackexchange-like submit comment window
- Retrieve comments from current post using SQL
- Display recent comments with gravatar and excerpts?
- Cannot get local avatars to show [closed]
- Limit user to one comment
- Is comment metadata included in the export file?
- Get a List of All Commenters on the Current Post
- WordPress comments on users profile
- wordpress threaded comments – customize nested ul / how child ul is displayd
- How to make a secure blog that is completely private?
- identify and delete spam comments from 3000 pending comments
- Hide comments column in WordPress backend
- Removing the limit on the number of nested comments
- How to call my custom WordPress Comment form without getting the comments?
- Auto delete comment if Contains
- How would I add the comment count to this sub-pages of current page snippet
- How can I test why the comment hook is not working?
- API Hook for After Commenting (for sharing on Facebook)
- How do i remove “Website” field from WordPress comments
- Placed on + only date (not time)
- Loading Comments From a Class?
- WordPress comments work locally only?
- comment reply by email
- have_comments not true for logged out visitors?
- “Discussion” checkboxes unchecked by default on pages? [duplicate]
- How to disable or hide WordPress.com as a social media login option for Jetpack Comments [closed]
- How to limit comment indentations to one level?
- Anonymize comments after one year
- Minimum allowed comment length only on a specific page
- How can I count only guests comments?
- How many members have made comments approved for an article?
- How to get a value from comment meta
- Comment System showing different type of IP
- Pending Comments
- Only Allow post author and “Premium” Role user to comment
- Anonymous spam comments when only registered users can comment
- Exclude the word comment from being referenced
- How to open up comments to all visitors
- Limit iframe output in comment-meta commentmetadata
- Is this a wordpress bug? get_comment_link auto shoots when user visits his dashboard
- Comment as post – understanding wp_list_comments
- Comments and pingbacks issues
- Cannot unapprove a WordPress comment
- how show attachment image in comments query
- Automatically register users with comments
- Comments only displaying when logged in
- Same comment section on every page
- reply comment below the comment box without reload page
- Force to show all fields in comment forms to the logged-in users
- Unable to view comments on my website
- Write html code in comments
- Using WordPress core pop-up comment function, doesn’t popup, maybe an elementor issue
- How to post one comment for all the translated posts
- How do i add comment fields in my page in WordPress
- twenty seventeen theme: comments UI not visible
- What is wrong with this? [closed]
- Comment moderation
- Redirect first time comments
- Posting XML in comment section
- How to check if post has previous_comments_link() and next_comments_link()
- Comment text area in single blog post and show comments if approved
- Comments – Ensure the correct field is highlighted for nested replies
- How to ‘If Author’ Comments Check
- selectively disable akismet
- How to hold all comments for moderation, including author’s comments on own post
- Comment Blacklist
- WordPress error when sending comment
- WordPress Page Template: Comment Filtering with Querystring
- Modify “Recent Comments” List in WP-Admin
- Comment submission & navigation redirects to default language
- comments are going to spam
- Why default comment fields don’t show up?
- How to enable truly anonymous posting in bbPress forums? [closed]
- TinyMCE in comment reply form showing toolbar but can’t edit reply
- Add pending for reply comment in console WordPress