-
Hello Rank Math Support Team,
I hope you’re doing well.
I’m encountering an issue where Google Search Console is reporting the following error: “Review has multiple aggregate ratings.” I am using the Porto theme, Rank Math Pro, and Judge.me for reviews.
I noticed that there is custom code in my functions.php file (under my child theme) that seems to be pulling review data from Judge.me into the Rank Math JSON-LD structured data. However, I’m not sure who added this code—it wasn’t me—and it appears to be causing a conflict with Rank Math’s schema, leading to the duplicate aggregate rating error.
Here is the code currently in my functions.php file:
php
Copy code
add_filter(‘rank_math/json_ld’, function($data, $jsonld) {
if (isset($data[‘richSnippet’][‘@type’]) && $data[‘richSnippet’][‘@type’] === ‘Product’) {
$product_id = get_the_ID();
$reviews = get_reviews_for_product($product_id);if (!empty($reviews)) {
$review_data = [];
foreach ($reviews as $review) {
$review_data[] = [
‘@type’ => ‘Review’,
‘reviewRating’ => [
‘@type’ => ‘Rating’,
‘bestRating’ => ‘5’,
‘ratingValue’ => $review[‘rating’],
‘worstRating’ => ‘1’,
],
‘author’ => [
‘@type’ => ‘Person’,
‘name’ => $review[‘author’],
],
‘reviewBody’ => $review[‘body’],
‘datePublished’ => $review[‘date’],
];
}
$data[‘richSnippet’][‘review’] = $review_data;
}
}return $data;
}, 99, 2);
I believe this is causing a conflict with Rank Math’s handling of the aggregateRating schema and is resulting in the Google Search Console error.Could you please advise on how to resolve this? Should this code be removed or adjusted, or is there another way to ensure that reviews from Judge.me integrate correctly with Rank Math without causing duplicate ratings in the structured data?
I’ve attached a screenshot of the error from Google Search Console for your reference.
https://imgur.com/a/KGSTOxVThank you!
The ticket ‘Review has multiple aggregate ratings’ is closed to new replies.