-
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.