-
Hello,
i posted a while back with the issue that there is a conflict between rankmath and stamped review plugin. They suggest me to add this code:
<script>function addEventListenerStamped(el, eventName, handler) {
if (el.addEventListener) { el.addEventListener(eventName, handler); }
else { el.attachEvent(‘on’ + eventName, function () { handler.call(el); }); }}
addEventListenerStamped(document, ‘stamped:reviews:loaded’, function(e) {
var ratingCount = jQueryStamped(‘meta[itemprop=”reviewCount”]’).attr(‘content’);
var ratingValue = jQueryStamped(‘meta[itemprop=”ratingValue”]’).attr(‘content’);var richSnippet = {
“@context”: “http://schema.org”,
“@type”: “Product”,
“@id”: “https://STORE.COM/URL/#product”
}if (parseInt(ratingValue) > 0){
richSnippet.aggregateRating = {
“@type”: “AggregateRating”,
“ratingValue”: ratingValue,
“reviewCount”: ratingCount
}
}
var script = document.createElement(‘script’);
script.type = ‘application/ld+json’;
script.innerHTML = JSON.stringify(richSnippet);
document.getElementsByTagName(‘head’)[0].appendChild(script);
});
</script>While wating for rankmath intergrate this code to solve the conflict, i get a short term solution to add this code from supportert:
/**
* Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
* Replace $schmea_type with schema name like article, review, etc.
* @param bool $value true/false Default false
* @param array $parts Post Data
* @param array $data Schmea Data
*
* @return bool
*/
add_filter( “rank_math/snippet/rich_snippet_review”, function( $value, $parts, $data ) {
return true;
}, 10, 3 );but it also not seams to work. I want to ask if you guys already got a solution
The ticket ‘Stamped Review not working’ is closed to new replies.