Integrate rating on Rank Math Rich Snippet
-
Hi,
we use the Rank Math Rich Snippet and the aggregate rating is not displayed. I researched why and i found that there is a filter to append your aggregate rating to rank math rich snippet.
I added the filter in my child theme, but i think should be better you add this snippet to the plugin.
add_filter('rank_math/snippet/rich_snippet_product_entity', function ($entity) { if (!is_plugin_active('feedaty-rating-for-woocommerce/feedaty-rating-for-woocommerce.php')) { return $entity; } $plugin_public = new Feedaty_Woocommerce_Rating_Public('feedaty-rating-for-woocommerce', FEEDATY_WOOCOMMERCE_RATING_VERSION); $markup = $plugin_public->append_microdata([]); $entity['aggregateRating'] = ['ratingValue' => $markup['aggregateRating']['ratingValue'], 'reviewCount' => $markup['aggregateRating']['reviewCount']]; return $entity; });
I hope you accept this suggestion.
- The topic ‘Integrate rating on Rank Math Rich Snippet’ is closed to new replies.