Get posts average star rating  

  RSS

mrlopeco
(@mrlopeco)
New Member
Joined: 2 months ago
Posts: 2
22/11/2019 10:05 am  

Hi there!

I feel little stupid because I couldn't find an answer to this question through the search function. Anyway!

How can I retrieve the average star rating of a post?

Thanks!

This topic was modified 2 months ago by Elvina

Quote
Topic Tags
Elvina
(@elvina)
Reputable Member Moderator
Joined: 5 months ago
Posts: 435
22/11/2019 10:58 am  

Hi @mrlopeco,

Please navigate to Dashboard > Comments > Settings > Comment List admin page, make sure the "After Content" checkbox is checked in the "Display Ratings" section. Save, delete all caches and check again.

More info here: https://wpdiscuz.com/docs/wpdiscuz-documentation/settings/comment-list-settings/#display_ratings

Don't forget to press CTRL + F5(twice) in the frontend before checking.


ReplyQuote
mrlopeco
(@mrlopeco)
New Member
Joined: 2 months ago
Posts: 2
22/11/2019 11:03 am  

Sorry, let me ask this again.

How can I get the average star rating of a post in a wp query.

there is a custom/meta field that counts the star rating if i am not wrong.

thanks


ReplyQuote
Elvina
(@elvina)
Reputable Member Moderator
Joined: 5 months ago
Posts: 435
22/11/2019 2:15 pm  

@mrlopeco,

Thank you for clarifying.

Here is the postmeta key you should use:

wpdiscuz_rating_count 

Please note, the Meta Key doesn't return the post average count. The key includes the count of each rating(5/4/3/5...). You should count the average value of each post manually to get the star rating of the post.


ReplyQuote
Share: