brainstormforce / all-in-one-schemaorg-rich-snippets

WordPress Plugin that Boost CTR. Improve SEO & Rankings. Supports most of the content type. Works perfectly with Google, Bing, Yahoo & Facebook.
http://wordpress.org/plugins/all-in-one-schemaorg-rich-snippets/
115 stars 44 forks source link

itemReviewed schema is invalid #86

Open bowser845 opened 4 years ago

bowser845 commented 4 years ago

Google has tightened up the criteria for the types of schema that Review can be applied to:

https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html

As such, the markup for 'Item Review / itemReviewed' in the plugin is kicking out an error as it has 'Thing' applied to it.

I have edited the plugin on my own sites to set the itemType to Product as my reviews are for products.

It would be good if the plugin had secondary options for setting the type of Item Review to match Google's new criteria. In my case I cannot use the current option of Product within the plugin as this does not mark it up as a review of a product.

To fix the issue for the time being I have replaced this code on line 92:

$review .= "<div class='snippet-data'> <span itemprop='itemReviewed'>".esc_attr($item )."</span></div>";

With this:

$review .= "<div class='snippet-data'> <span itemprop='itemReviewed' itemscope itemtype='http://schema.org/Product'><span itemprop='name'>".esc_attr($item )."</span></span></div>"