I’ve done exactly something similar. First, use get_comment_meta
for getting the per comment rating, you don’t need the SQL for it. Then get the average rating (addition of individual comment ratings on a single post / number of comments on this post). Then store this average value as post meta for this post. Use WP_Query
custom fields parameters for ordering these posts.
Related Posts:
- How to get a value from comment meta
- What for is the table “wp_commentmeta” exactly?
- Getting Post Comments for post ID using WP_Query() and a Custom Loop?
- Running a function on comment status change
- Is it possible to show custom comment metadata in the admin panel?
- Add Comment Custom Field
- Upload images with comment
- Add a drop down list to comment form?
- An action hook where a comment meta is updated
- What are the additional fields in wp_comments used for?
- Display comment meta data after quick update
- WordPress Comment. Need some details of wp_comments DB table
- How would I count the number of times a comment meta field’s value is in a post’s entire comments?
- Get comments from post and sort by commentmeta value
- How to get comment images stored as serialized comment meta
- Name of comment field differs on different sites
- Make every comment go to the spam folder
- How to display comment meta under each comment content
- Update comment meta for all comments of specific post
- How to get Post title by locale with Qtranslate-X
- get_comment_meta not behaving as expected
- How / where is the wp_query object created for RSS feeds?
- How to filter comments by comment_meta
- Top rated posts Average rating issue
- WordPress Commenting System User access and Security
- Add comment meta
- Comment-Meta doesn’t work with latest wordpress update
- add field comment [duplicate]
- Loop not displaying comments_popup_link
- Use country flag as user avatar based on comments IP address?
- Would switching to InnoDB from MyISAM improve performance of comments table?
- How can I limit the number of comments per registered user per day?
- How can I control the comment counts filtering my CPT replies?
- How to auto-approve internal pingbacks?
- Comments waiting but no comments found
- Programmatically block commenting by restricting view of comment form
- What is comment_karma?
- How to override function twentyten_comment
- Disqus over the default commenting engine, what are some pros and cons?
- count number of user comments with a specific comment meta value
- How To Remove The “Click here to cancel reply” Link From The WordPress Comment Form
- Plugin from WordPress.com for comment notification…available? [closed]
- How to add text to comment form #content textarea?
- How can I highlight admin comments?
- Why are my comments closed?
- Load comments per post on click with AJAX
- Block comments from search engine indexing
- Create a “Reject” action for comments?
- Add action on delete comments?
- Changing “submitted on date” of comments
- Filter custom comment type from Manage Comments & Dash Widgets
- WordPress custom form action url
- How to add a strip of visual editor on top of comments textarea
- Threaded comments not working
- Customizing comments pagination for bootstrap
- woocommerce allow users to select or use avatar
- Comments on homepage (index.php) are duplicated under posts
- Comment Form – E-mail Not Required!
- Get a total count for all comments and display result
- Email notification to an email address other than admin for custom type post comments in wordpress
- Notification if Comment Author Field is left empty. E.g. change input border colour
- List comments received by every posts of an specific author
- Filtering the Admin Comments List to Show Only Comments from the Current User?
- Ajax submit comments
- Comment Link from get_comments()?
- How do I automatically insert some text in the comment textbox on submit?
- I cannot view the comments
- if null or int(0) value to 0
- In wp_list_comments comment dates won’t work?
- Only show own comments in admin panel
- Sending comment notifications to different recipients depending on taxonomy terms
- Replying to comments
- Custom comment link
- unsetting required fields in the comment reply form
- Problem code and show comments
- Highlight comments made by registered users of the site
- It doesn’t matter if I have more than one comment. get_comments_number still equal to one?
- Simple spam check for valid domain in commenter’s email address
- Allowing WordPress.org/com accounts on a self-hosted install
- How to remove the “comments” bit that appears next to or below the posts
- Post comments don’t show
- Update post “A” on comment submition on post “B”
- Comments counter only for Authors Posts
- Pre- Approved Comment Capability
- Delete comments function
- Comment form not working
- Comments page id wp_list_comments
- transition_comment_status gets called when untrashing comments
- spacebar is not working in input and textarea
- wp-editor-area textarea disapear on cancel-comment-reply-link click
- Conditionally process comments while ignoring replies
- Required Field for Comment parent only?
- How do I separate author avatars and comments in 3.4.2?
- writing a plugin, how to disable the comment form altogether?
- What filter or action to replace comments or add new comment system
- Function to get a list of all comments on 1 post [closed]
- Auto delete WordPress comments
- How to disable comments on new blog post, but allow on new products?
- Get approved comments or comments that the author is me
- Show/Hide comments