Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. Iâm sorry for any inconvenience this issue may have caused you.
Rank Math does not have a feature to accept reviews from users/visitors. If you want to collect the user ratings, then you will have to use a third-party plugin like WP Review to do that.
Here’s a link for an example where we use the WP Review plugin as an example to get the ratingValue
and ratingCount
variables:
https://rankmath.com/kb/schema-templates/#aggregateRating
Hope that helps.
Thank you.
my bad I must’ve been unclear.
I know Rank Math does not provide this and I already use a review plugin. My question is meant totally different.
Google Search console noticated me that for a particular product the aggregate rating schema is not found; while the product has 1 review.
Please see the rank math article below.
https://rankmath.com/kb/aggregate-rating-error/
In this article Rank Math explaines how to solve this by placing a code snippet in the functions.php file. In this code snippet I have to replace the users_rating with my own post meta. And I have to replace the users_rating_count with the products rating count.
Code snippet:
add_filter(ârank_math/snippet/rich_snippet_product_entityâ, function ($entity) {
$score = get_post_meta(get_the_ID(), âusers_ratingâ, true); // Replace with your rating post meta.
$count = get_post_meta(get_the_ID(), âusers_rating_countâ, true); // Replace with your rating count post meta.
$entity[âaggregateRatingâ] = array(
â@typeâ => âaggregateRatingâ,
âratingValueâ => $score,
âratingCountâ => $count,
);
return $entity;
});
What I want to know is that…with what information do I have to replace this? where do I find this information.
Hello,
The values for that would be inside the postmeta table with the ID of the post or page where you are trying to apply this method.
If you are using the plugin mentioned in the tutorial you can use the keys wp_review_user_reviews
and wp_review_review_count
.
Don’t hesitate to get in touch if you have any other questions.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.