1. You need to modify $schema instead of replacing it. Example:
add_filter( "site-reviews/schema/LocalBusiness", function( array $schema ) {
$schema['telephone'] = '0123456789';
return $schema;
});
2. Please send me a link so I can see the issue.
Hi, Gemini Labs,
I’ve sent you a link with JSON-LD code generated by Site Reviews to your email, site-reviews[at]geminilabs.io.
<script type="application/ld+json">
[{
"@context": "http:\/\/schema.org",
"@type": "LocalBusiness",
"name": "\u4e2d\u58e2\u79ae\u5100\u516c\u53f8\u3001\u4e2d\u58e2\u846c\u5100\u793e\u3001\u4e2d\u58e2\u79ae\u5100\u516c\u53f8\u63a8\u85a6\u3001\u4e2d\u58e2\u846c\u5100\u793e\u63a8\u85a6\u3001\u6843\u5712\u64bf\u9aa8\uff1a\u975c\u5fc3\u751f\u547d\u79ae\u5100\u516c\u53f8\uff0c\u5168\u53f0\u5c08\u4eba\u670d\u52d9\uff0824H\uff09\u3002",
"description": "",
"image": "https:\/\/peaceful.tw\/wp-content\/themes\/iweb\/images\/logo.png",
"url": "",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": 5,
"reviewCount": 33
},
"address": "\u6843\u5712\u5e02\u4e2d\u58e2\u5340\u4e2d\u798f\u8def 850 \u865f",
"priceRange": "128,000 - 268,000",
"telephone": "+886926822319"
}]
</script>
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
Thank you.
-
This reply was modified 8 years, 5 months ago by
bdbrown.
There is nothing wrong with the JSON-LD, those numbers you are seeing are actually UTF-8 hexadecimal representations of the Chinese characters. If you go to https://search.google.com/structured-data/testing-tool and enter your URL you will see that the schema is being read correctly as expected.
However, it’s not really necessary to encode UTF-8 characters in the JSON-LD so in the next version I’ll adjust Site Reviews to not do that.
Version 2.9.2 should correct the issue, although it was purely a cosmetic one. 🙂
Hi, Gemini Labs,
My current solution for this cosmetic one is to add ‘JSON_UNESCAPED_UNICODE’ in ‘site-reviews\plugin\Schema.php’ at line 138. I am not sure if this is the right way, but it looks ‘beautiful’ now.
* @return null|string
*/
public function render()
{
if( is_null( $this->app->schemas ))return;
return sprintf( '<script type="application/ld+json">%s</script>', json_encode(
apply_filters( 'site-reviews/schema/all', $this->app->schemas ), JSON_UNESCAPED_UNICODE
));
}
I am much looking forward to Version 2.9.2.
===========================================
BTW, I found another issue that some setting gone (become unchecked) in plugin setting area after I press save in other tab within settion area.
To be specific, I first check ‘Name’ filed in tab ‘Required Fields’, then I change ‘Rich Snippets (schema.org)’ in tab ‘Reviews’. When I return to the ‘Required Fields’, the check of ‘Name’ disapeared.
v2.9.2 was released yesterday.
Regarding the settings, each section has its own “Save Settings” button. You must save the settings before going to another settings section.