RankMath Issue
-
Hello,
Im using your progin with RankMath seo but I see some problems.I have added this code to functions.php but I see this error in the snippet test:
“Invalid object type for fielnd “itemReviewed””
Can you help me please fix Snippet code to be valind with RankMath for products and articles visitor’s rankings?
add_filter( "rank_math/snippet/rich_snippet_product_entity", "custom_kksr_rating"); function custom_kksr_rating ( $entity ) { $id = get_the_ID(); $temprend = get_post_meta('kksr_sd'); //var_dump($temprend); $i = get_post_meta($id, '_kksr_casts', true ); $sumstar = get_post_meta($id, '_kksr_ratings', true ); $star = round($sumstar / $i); $entity['aggregateRating'] = [ "@type" => "AggregateRating", "ratingValue" => "$star", "reviewCount" => "$i", ]; //var_dump($entity); return $entity; }
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘RankMath Issue’ is closed to new replies.